Skip to content
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

Add Py_IsFinalizing() #66

Merged
merged 1 commit into from
Aug 18, 2023
Merged

Add Py_IsFinalizing() #66

merged 1 commit into from
Aug 18, 2023

Conversation

vstinner
Copy link
Member

No description provided.

@vstinner
Copy link
Member Author

PR waiting until python/cpython#108032 is merged in Python upstream.

@albanD
Copy link
Contributor

albanD commented Aug 16, 2023

Hey!

I have a related question but it is not 100% about this PR so feel free to delete if you think this is not the right place to ask.

There have been quite a few discussions related to Py_IsFinalizing and Py_Initialized and how to use them to ensure graceful exit when c++ keeps things alive past python runtime lifetime.
https://github.com/pytorch/pytorch/blob/589072afa1a196270b0298460c1f419e209da6ea/torch/csrc/utils/pybind.h#L178-L185

Is this comment still accurate for the latest version of CPython? Should we update our use of these functions to use the new public API being introduced?

@vstinner
Copy link
Member Author

Is this comment still accurate for the latest version of CPython?

I don't know. This PR is on the pythoncapi-compat project, not the Python project.

@vstinner vstinner marked this pull request as ready for review August 18, 2023 10:43
@vstinner vstinner merged commit 1bb4e16 into main Aug 18, 2023
17 checks passed
@vstinner vstinner deleted the is_finalizing branch August 18, 2023 10:47
@vstinner
Copy link
Member Author

I dug into PyPy tarball releases to check which version added Py_IsFinalizing(): it's PyPy 7.3. Sadly, on GitHub Actions we only tests versions newer than PyPy 7.3.0: PyPy 7.2 and older are not tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants