-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Hi,
I'd like the C API working group to begin considering PEP 788, "Protecting the C API from Interpreter Finalization", for recommendation to the SC.
The TL;DR is that we get a new PyThreadState_Ensure function to replace PyGILState_Ensure, which has a number of issues regarding subinterpreters and thread-safety. As part of introducing that, it includes several new interpreter "guarding" APIs that prevent an interpreter from shutting down, so things don't unexpectedly deallocate.
The main impact here is that the proposal deprecates PyGILState and schedules it for removal in a future version, so there will be a very huge migration from PyGILState_Ensure to PyThreadState_Ensure. APIs that use PyGILState_Ensure under the hood (for example, _PyObject_Dump in CPython) will probably need to be deprecated and given counterparts that take a correct PyInterpreterGuard parameter.
I'm not sure it's time to start formally voting on the proposal, but it would be good to hear some of the workgroup's feedback on the current design.