-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
gh-108014: Add Py_IsFinalizing() function #108032
Conversation
@ericsnowcurrently: Oh, that's a "feature" PR, so I will need a formal approval to merge it :-) |
I prepared python/pythoncapi-compat#66 to add the function to the pythoncapi-compat project. |
Doc/c-api/init.rst
Outdated
Return non-zero if the Python interpreter is :term:`shutting down | ||
<interpreter shutdown>`, return 0 otherwise. |
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.
Is this referring to the runtime (AKA main interpreter) or to the current interpreter? I'd expect it to be the current interpreter.
Would it make sense to explicitly pass an interpreter and use NULL
to mean the current one (or main)?
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 copied the documentation of the sys.is_finalizing() function. If you want a different feature (pass an interpreter), I would prefer to have a different function.
It's set by Py_Finalize() which finalizes the main interpreter: other sub-interpreters should be deleted before explicitly, no?
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 updated the doc to specify that we are talking about the main interpreter.
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.
Misc/NEWS.d/next/C API/2023-08-16-17-16-19.gh-issue-108014.wXN3CF.rst
Outdated
Show resolved
Hide resolved
…3CF.rst Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
Thanks for the review @ericsnowcurrently and @serhiy-storchaka! |
Follow-up: @wjakob asks to add this new function to the limited C API version 3.13. |
📚 Documentation preview 📚: https://cpython-previews--108032.org.readthedocs.build/