-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Docs: C API: Improve documentation around non-Python threads with subinterpreters #131087
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: C API: Improve documentation around non-Python threads with subinterpreters #131087
Conversation
I can make backport if review passes |
I'll deal with resolving conflicts later today. |
I've opted to not backport this because we're using thread state terms now. |
ok :)
…On Mon, Mar 24, 2025 at 10:44 AM Peter Bierma ***@***.***> wrote:
I've opted to not backport this because we're using thread state terms now.
—
Reply to this email directly, view it on GitHub
<#131087 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BNITW56N5GH66FQNT6MXOHT2WAK6FAVCNFSM6AAAAABYY2QLM2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBYGM3TQNZSGE>
.
You are receiving this because you commented.Message ID:
***@***.***>
[image: ZeroIntensity]*ZeroIntensity* left a comment
(python/cpython#131087)
<#131087 (comment)>
I've opted to not backport this because we're using thread state terms now.
—
Reply to this email directly, view it on GitHub
<#131087 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BNITW56N5GH66FQNT6MXOHT2WAK6FAVCNFSM6AAAAABYY2QLM2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBYGM3TQNZSGE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@encukou I forgot about this one. Would you mind finishing up your review when you have some time? |
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
Co-authored-by: Victor Stinner <[email protected]>
Thanks @ZeroIntensity for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…interpreters (pythonGH-131087) (cherry picked from commit af6b3b8) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
Just did. Sorry for the delay! |
GH-134130 is a backport of this pull request to the 3.14 branch. |
…ith subinterpreters (GH-131087) (GH-134130) Docs: C API: Improve documentation around non-Python threads with subinterpreters (GH-131087) (cherry picked from commit af6b3b8) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
@da-woods's comment inspired me to improve some of the documentation here. This should play pretty nicely with the incoming
PyThreadState_Ensure
API, and with GH-127990 whenever that gets merged.PyThreadState *
to support subinterpreters in a non-Python thread.PyGILState_Ensure
's note to a warning, and mention that it can actually crash the interpreter. (See Debug build assertion failure with native threads attempting to acquire GIL on termination #131012 and PyGILStateEnsure() (Probably) Crashes If Called After Finalization #124619.)PyGILState_Check
always returns 1 if subinterpreters are enabled.PyGILState_GetThisThreadState
doesn't account for non-GILState
thread states.PyThreadState_Swap
will also hang the thread during finalization (but unlikeGILState
, it shouldn't crash).📚 Documentation preview 📚: https://cpython-previews--131087.org.readthedocs.build/en/131087/c-api/init.html#supporting-subinterpreters-in-non-python-threads