Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[3.13] gh-119132: Update sys.version to identify free-threaded or not. (gh-119134)#119153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
corona10 merged 1 commit intopython:3.13frommiss-islington:backport-c141d43-3.13
May 18, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletionsLib/platform.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1153,17 +1153,16 @@ def _sys_version(sys_version=None):
if result is not None:
return result

sys_version_parser = re.compile(
r'([\w.+]+)\s*' # "version<space>"
r'\(#?([^,]+)' # "(#buildno"
r'(?:,\s*([\w ]*)' # ", builddate"
r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)<space>"
r'\[([^\]]+)\]?', re.ASCII) # "[compiler]"

if sys.platform.startswith('java'):
# Jython
jython_sys_version_parser = re.compile(
r'([\w.+]+)\s*' # "version<space>"
r'\(#?([^,]+)' # "(#buildno"
r'(?:,\s*([\w ]*)' # ", builddate"
r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)<space>"
r'\[([^\]]+)\]?', re.ASCII) # "[compiler]"
name = 'Jython'
match =sys_version_parser.match(sys_version)
match =jython_sys_version_parser.match(sys_version)
if match is None:
raise ValueError(
'failed to parse Jython sys.version: %s' %
Expand All@@ -1190,7 +1189,14 @@ def _sys_version(sys_version=None):

else:
# CPython
match = sys_version_parser.match(sys_version)
cpython_sys_version_parser = re.compile(
r'([\w.+]+)\s*' # "version<space>"
r'(?:experimental free-threading build\s+)?' # "free-threading-build<space>"
r'\(#?([^,]+)' # "(#buildno"
r'(?:,\s*([\w ]*)' # ", builddate"
r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)<space>"
r'\[([^\]]+)\]?', re.ASCII) # "[compiler]"
match = cpython_sys_version_parser.match(sys_version)
if match is None:
raise ValueError(
'failed to parse CPython sys.version: %s' %
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
Update :data:`sys.version` to identify whether the build is default build or
free-threading build. Patch By Donghee Na.
9 changes: 7 additions & 2 deletionsPython/getversion.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,15 +6,20 @@
#include "patchlevel.h"

static int initialized = 0;
static char version[250];
static char version[300];

void _Py_InitVersion(void)
{
if (initialized) {
return;
}
initialized = 1;
PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.80s",
#ifdef Py_GIL_DISABLED
const char *buildinfo_format = "%.80s experimental free-threading build (%.80s) %.80s";
#else
const char *buildinfo_format = "%.80s (%.80s) %.80s";
#endif
PyOS_snprintf(version, sizeof(version), buildinfo_format,
PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler());
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp