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 PyInterpreterState.runtime. #80999
Comments
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. My plan is to add a PyInterpreterState.runtime field. It can then be used in the same way we use PyThreadState.interp to access the interpreter state. |
I don't see the point of PyInterpreterState.runtime:
|
Eric is working on a different approach: https://bugs.python.org/issue36854 |
This change introduced a regression: I had to revert the change to fix Python for 3.8 beta1 release. |
By the way, I have questions about the rationale of this change.
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: 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. |
See https://bugs.python.org/issue37135#msg344509 to reproduce https://bugs.python.org/issue37135 crash without multiprocessing: with this procedure, I reproduce the crash immediately on Linux. No need for a magic super slow buildbot. |
I added PyInterpreterState.runtime in bpo-36710: commit 01b1cc1
--
Funny/not funny, I introduced the same bug and I fixed it in bpo-39877. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: