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-127989: C API: Refer to attached thread states instead of the GIL#127990

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
encukou merged 76 commits intopython:mainfromZeroIntensity:clarify-gil-tstate
Mar 20, 2025

Conversation

ZeroIntensity
Copy link
Member

@ZeroIntensityZeroIntensity commentedDec 16, 2024
edited by github-actionsbot
Loading

As I said in the issue, this is a big change, but it should help clear things up for users. Any feedback, or pointing out flaws, is definitely appreciated!


📚 Documentation preview 📚:https://cpython-previews--127990.org.readthedocs.build/

@ZeroIntensity
Copy link
MemberAuthor

Ok, I've come up with a compromise here. There seems to be quite a bit of opposition to calling this a "runtime context," so I've kept the phrase "thread state," but I've changed the glossary definitions to mostly fit Eric's suggestions. At the bottom of the "attached thread state" definition, I've added a note about free-threading:

In free-threaded builds of Python, threads can concurrently hold an attached thread state, allowing for true parallelism of the bytecode interpreter.

I think this is an important part to emphasize--from the user's perspective, all free-threading really does is allow for multiple active thread states at a time, and that gives a good intuitive sense of why things likePyGILState_Ensure are still needed on FT builds. If there's any other places we should try to mention this, let me know.

Regarding this part:

current does not imply attached, but attached does implies current

I decided just to drop any mention of the "current thread-local state pointer" and just replaced everything with being either "attached" or not. It's probably better to keep how we expose thread states out of the documentation.

So, with all that in mind: I didn't expect the Spanish Inquisition

@bedevere-app
Copy link

Nobody expects the Spanish Inquisition!

@ericsnowcurrently: please review the changes made to this pull request.

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. I'm fine with "attached thread state" and "active thread state".

Copy link
Member

@encukouencukou left a comment

Choose a reason for hiding this comment

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

LGTM; I'll merge ~tomorrow if there are no objections.

IMO, it's fine to have C API details in the glossary for terms related to the C API -- which these are.

My main worry is that per the SC's pronouncement on PEP 703, all changes related to free-threading should be revertable. Unfortunately, we can't really put#ifs in the docs, so the revert will need to start with a manual search for "free-threading".
But, I expect the term "attached thread state" -- and so, the bulk of the changes here -- to stay even if nogil needs to be abandoned for some reason.

@encukou
Copy link
Member

Oh, I missed the change request (is it just me or were these more prominent not that long ago?)

@ericsnowcurrently, do you want to block this iteration?

@ericsnowcurrently
Copy link
Member

No real objections; I defer to you, Victor and Alyssa.

@vstinner
Copy link
Member

vstinner commentedMar 20, 2025
edited
Loading

I already approved the PR :-)

@encukou
Copy link
Member

Thanks! Let's build on this :)

ngoldbaum reacted with heart emoji

@encukouencukou merged commit86d5fa9 intopython:mainMar 20, 2025
24 checks passed
@github-project-automationgithub-project-automationbot moved this fromTodo toDone inDocs PRsMar 20, 2025
@ZeroIntensityZeroIntensity deleted the clarify-gil-tstate branchMarch 20, 2025 12:09
seehwan pushed a commit to seehwan/cpython that referenced this pull requestApr 16, 2025
…the GIL (pythonGH-127990)Co-authored-by: Victor Stinner <vstinner@python.org>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ncoghlanncoghlanncoghlan left review comments

@vstinnervstinnervstinner approved these changes

@encukouencukouencukou approved these changes

@FFY00FFY00Awaiting requested review from FFY00FFY00 is a code owner

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

Assignees
No one assigned
Labels
docsDocumentation in the Doc dirskip news
Projects
Status: Done
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

7 participants
@ZeroIntensity@colesbury@ngoldbaum@ncoghlan@encukou@ericsnowcurrently@vstinner

[8]ページ先頭

©2009-2025 Movatter.jp