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

gh-119132: Update sys.version to identify free-threaded or not.#119134

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 13 commits intopython:mainfromcorona10:gh-119132
May 18, 2024

Conversation

corona10
Copy link
Member

@corona10corona10 commentedMay 17, 2024
edited by bedevere-appbot
Loading

hugovk reacted with thumbs up emojistonebig reacted with heart emoji
@corona10corona10 changed the titlegh-119132: Update buildinfo to identify free-threaded or not.[WIP] gh-119132: Update buildinfo to identify free-threaded or not.May 17, 2024
@corona10corona10 marked this pull request as draftMay 18, 2024 00:07
@nineteendo
Copy link
Contributor

nineteendo commentedMay 18, 2024
edited
Loading

Could we maybe leave out "default" for the normal build? It doesn't really add value:

Python 3.14.0a0 (heads/main-dirty:31a28cbae0, May 17 2024, 17:30:32) [GCC 14.1.1 20240507 (Red Hat 14.1.1-1)]Python 3.14.0a0 (heads/main-dirty:31a28cbae0, May 17 2024, 17:30:32, free-threading) [GCC 14.1.1 20240507 (Red Hat 14.1.1-1)]

The tests on GitHub don't include "(default)" either. Maybe even like this:

Python 3.14.0a0 (heads/main-dirty:31a28cbae0, May 17 2024, 17:30:32) [GCC 14.1.1 20240507 (Red Hat 14.1.1-1)]Python 3.14.0a0 (free-threading) (heads/main-dirty:31a28cbae0, May 17 2024, 17:30:32) [GCC 14.1.1 20240507 (Red Hat 14.1.1-1)]

This could even work for--version, but some people might rely on the format:

Python 3.14.0a0Python 3.14.0a0 (free-threading)

@nineteendo
Copy link
Contributor

You still need to update this:

cpython/Lib/platform.py

Lines 1156 to 1161 in81c3130

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]"

@nineteendo
Copy link
Contributor

Currently this test is failing:

deftest_sys_version(self):

Do you have an opinion on not including "default"?

@corona10
Copy link
MemberAuthor

Do you have an opinion on not including "default"?

Hey, I am under testing. Would you like to leave a comment once I convert the PR into the official PR?

@nineteendo
Copy link
Contributor

Old regex:

([\w.+]+)\s*\(#?([^,]+)(?:,\s*([\w]*)(?:,\s*([\w:]*))?)?\)\s*\[([^\]]+)\]?

New regex:

([\w.+]+)\s*\(#?([^,]+)(?:,\s*([\w]*)(?:,\s*([\w:]*))?)(?:,\s*(free-threading))?\)*\s*\[([^\]]+)\]?

Unmatched string:

2.4.3 (truncation) [GCC]

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
@corona10
Copy link
MemberAuthor

@nineteendo Thanks for the comment

Still issue (nah I am really bad at regex)

- ('CPython', '2.4.3', '', '', 'truncation) \n', '', 'GCC')?                                         ----+ ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')

@vstinner
Copy link
Member

I proposed a similar idea last August, but it was rejected at that time:#108239

@vstinner
Copy link
Member

I suggest to mentionsys.version in the PR title.

The "(...)" part of sys.version is the Git information, I would prefer to not touch it.

If we change sys.version, I would prefer to "add a new field" in sys.version. For example, addfree-threading or[free-threading] after the version. Example:

Python 3.14.0a0 free-threading (heads/main:81c3130c51, May 18 2024, 07:29:44) [GCC 14.0.1 20240411 (Red Hat 14.0.1-0)] on linux

The drawback of changingsys.version is that it breaks tooling parsing it in a strict way.

corona10 and nineteendo reacted with thumbs up emoji

@corona10
Copy link
MemberAuthor

corona10 commentedMay 18, 2024
edited
Loading

Then we need to discuss with@hugovk

@nineteendo
Copy link
Contributor

You accidentally added* after\):

-([\w.+]+)\s*\(#?([^,]+)(?:,\s*([\w ]*)(?:,\s*([\w :]*))?)?(?:,\s*(free-threading))?\)*\s*\[([^\]]+)\]?+([\w.+]+)\s*\(#?([^,]+)(?:,\s*([\w ]*)(?:,\s*([\w :]*))?)?(?:,\s*(free-threading))?\)\s*\[([^\]]+)\]?

But I would prefer a new field as well.

@corona10corona10 changed the title[WIP] gh-119132: Update buildinfo to identify free-threaded or not.gh-119132: Update sys.version to identify free-threaded or not.May 18, 2024
@corona10
Copy link
MemberAuthor

@Yhg1s What do you think about backporting it into the 3.13 since it will help the free-threading ecosystem?

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM, but see my comment on regex.

Co-authored-by: Victor Stinner <vstinner@python.org>
@corona10corona10 added the needs backport to 3.13bugs and security fixes labelMay 18, 2024
@corona10corona10enabled auto-merge (squash)May 18, 2024 19:20
@corona10corona10 merged commitc141d43 intopython:mainMay 18, 2024
@miss-islington-app
Copy link

Thanks@corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 18, 2024
…pythongh-119134)(cherry picked from commitc141d43)Co-authored-by: Donghee Na <donghee.na@python.org>
@bedevere-app
Copy link

GH-119153 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelMay 18, 2024
corona10 added a commit that referenced this pull requestMay 18, 2024
gh-119134) (#119153)gh-119132: Update sys.version to identify free-threaded or not. (gh-119134)(cherry picked from commitc141d43)Co-authored-by: Donghee Na <donghee.na@python.org>
@smontanaro
Copy link
Contributor

Sorry, I haven't been paying close attention, but was there a decision not to tweaksys.version_info as well?

>>> sys.version'3.14.0a0 experimental free-threading build (heads/main:697465ff88e, May 19 2024, 07:40:21) [Clang 15.0.0 (clang-1500.3.9.4)]'>>> sys.version_infosys.version_info(major=3, minor=14, micro=0, releaselevel='alpha', serial=0)

It seems that since it's a named tuple there'd be little problem adding a new field which distinguishes the two builds. Something like:

>>> sys.version_infosys.version_info(major=3, minor=14, micro=0, releaselevel='alpha', serial=0, free_threading=True)

@gpshead
Copy link
Member

was there a decision not to tweaksys.version_info as well?

build information is not part of version_info. the version string is meant for humans and includes other detailed things that are also not in version_info such as compiler details.

there's thehttps://docs.python.org/3.13/library/sys.html#sys._is_gil_enabled may-change-in-the-future API for people wanting to know thecurrent status of the GIL regardless of build type.

nineteendo and erlend-aasland reacted with thumbs up emoji

@smontanaro
Copy link
Contributor

Thanks. Just checking. As long as there is somewhere to query the status at run-time without parsing a human-readable string.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@gpsheadgpsheadgpshead approved these changes

@vstinnervstinnervstinner left review comments

@nineteendonineteendonineteendo left review comments

@hugovkhugovkhugovk approved these changes

@erlend-aaslanderlend-aaslanderlend-aasland approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

7 participants
@corona10@nineteendo@vstinner@smontanaro@gpshead@hugovk@erlend-aasland

[8]ページ先頭

©2009-2025 Movatter.jp