-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
gh-127791: Fix, document, and test PyUnstable_AtExit
#127793
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
Conversation
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
PyThreadState *tstate = _PyThreadState_GET(); | ||
_Py_EnsureTstateNotNULL(tstate); |
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.
You can use PyInterpreterState_Get(), or PyThreadState_Get(), instead: it does the same.
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.
I think it's better to be explicit rather than do it with one of those.
Thanks @ZeroIntensity for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, @ZeroIntensity and @vstinner, I could not cleanly backport this to
|
I merged your PR, thanks. Sadly, the automated backport failed. Would you mind to backport the change manually to 3.13? |
…ythonGH-127793) (cherry picked from commit d5d84c3) Co-authored-by: Peter Bierma <[email protected]>
GH-127819 is a backport of this pull request to the 3.13 branch. |
) (#127819) * Fix merge conflicts. * [3.13] gh-127791: Fix, document, and test `PyUnstable_AtExit` (GH-127793) (cherry picked from commit d5d84c3) Co-authored-by: Peter Bierma <[email protected]>
I did several things here:
_testcapi
instead of_testinternalcapi
.PyUnstable_AtExit
now ensures that the caller holds the GIL.PyUnstable_AtExit
(and link to it inPy_AtExit
).last_ll_callback
field on the atexit state (nothing used it).PyUnstable_AtExit
isn't well tested and undocumented #127791📚 Documentation preview 📚: https://cpython-previews--127793.org.readthedocs.build/en/127793/c-api/init.html#c.PyUnstable_AtExit