Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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:
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 like Regarding this part:
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 |
Nobody expects the Spanish Inquisition! @ericsnowcurrently: please review the changes made to this pull request. |
There was a problem hiding this 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".
There was a problem hiding this 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#if
s 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.
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? |
No real objections; I defer to you, Victor and Alyssa. |
vstinner commentedMar 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I already approved the PR :-) |
Thanks! Let's build on this :) |
86d5fa9
intopython:mainUh oh!
There was an error while loading.Please reload this page.
…the GIL (pythonGH-127990)Co-authored-by: Victor Stinner <vstinner@python.org>
Uh oh!
There was an error while loading.Please reload this page.
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/