[issue36818] Add PyInterpreterState.runtime.

STINNER Victor report at bugs.python.org
Mon Jun 3 21:21:32 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

By the way, I have questions about the rationale of this change.

> Currently we use the _PyRuntime static global to access the runtime state in various places.  At the same time, in thread contexts we get access to the thread state from Thread-Local Storage and the interpreter state by indirection from there.  We should do the same for the runtime state instead of using the global directly.

Right now I'm confused. _PyRuntimeState contains scatted states: things which should be moved to PyInterpreterState or even PyThreadState, and things which should remain in _PyRuntimeState. My notes on this topic:
https://pythoncapi.readthedocs.io/runtime.html

Is PyInterpreterState.runtime a temporary fix until things are moved?

Or do you plan to never access _PyRuntime directly, and always through interp->runtime?

It seems like in the short term, we must continue to access "_PyRuntime" through a separated "runtime" pointer passed to functions, to handle daemon threads during Python shutdown.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36818>
_______________________________________


More information about the Python-bugs-list mailing list