[issue36124] Provide convenient C API for storing per-interpreter state
Petr Viktorin
report at bugs.python.org
Mon Mar 4 05:42:02 EST 2019
Petr Viktorin <encukou at gmail.com> added the comment:
PyModule_GetState() gives you *per-module* state, not per-interpreter state.
Module objects are shared across subinterpreters, unless you use multi-phase initialization.
> PyModule_GetState() requires having the module object that corresponds
> to the given interpreter state. I'm not sure how a C extension module
> is supposed to get its own module object corresponding to the current
> interpreter state, without getting it from the caller in some way.
This is the problem described in PEP 573: you don't always have access to your own module object. That keeps some more complex modules from switching to multi-phase init.
Unless this issue can wait for when PEP 580, PEP 573, and possibly some fallout of unknown unknowns are solved, let's add PyInterpreterState_GetDict for now.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36124>
_______________________________________
More information about the Python-bugs-list
mailing list