gh-127791: Fix, document, and test PyUnstable_AtExit#127793
Merged
vstinner merged 7 commits intopython:mainfrom Dec 11, 2024
Merged
gh-127791: Fix, document, and test PyUnstable_AtExit#127793vstinner merged 7 commits intopython:mainfrom
PyUnstable_AtExit#127793vstinner merged 7 commits intopython:mainfrom
Conversation
vstinner
approved these changes
Dec 10, 2024
Comment on lines
+30
to
+31
| PyThreadState *tstate = _PyThreadState_GET(); | ||
| _Py_EnsureTstateNotNULL(tstate); |
Member
There was a problem hiding this comment.
You can use PyInterpreterState_Get(), or PyThreadState_Get(), instead: it does the same.
Member
Author
There was a problem hiding this comment.
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 |
Member
|
I merged your PR, thanks. Sadly, the automated backport failed. Would you mind to backport the change manually to 3.13? |
ZeroIntensity
added a commit
to ZeroIntensity/cpython
that referenced
this pull request
Dec 11, 2024
…ythonGH-127793) (cherry picked from commit d5d84c3) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
|
GH-127819 is a backport of this pull request to the 3.13 branch. |
vstinner
pushed a commit
that referenced
this pull request
Dec 11, 2024
srinivasreddy
pushed a commit
to srinivasreddy/cpython
that referenced
this pull request
Jan 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I did several things here:
_testcapiinstead of_testinternalcapi.PyUnstable_AtExitnow ensures that the caller holds the GIL.PyUnstable_AtExit(and link to it inPy_AtExit).last_ll_callbackfield on the atexit state (nothing used it).PyUnstable_AtExitisn't well tested and undocumented #127791📚 Documentation preview 📚: https://cpython-previews--127793.org.readthedocs.build/en/127793/c-api/init.html#c.PyUnstable_AtExit