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.
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.
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.
I updated the doc to specify that we are talking about the main interpreter.
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/