-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Partial moving of core objects to interpreter state is incorrect at best, unsafe at worse. #89854
Comments
We currently have an unstable state in the VM where some core objects are static and some are per-interpreter. For example, smalls ints are allocated per-interpreter, but many classes are allocated statically. E.g. consider this sequence:
The above is just an example. Classes have many references to ints, floats, code objects, etc. Any of those could have the same issue. All objects that form the core object graph must either be entirely static, or entirely per-interpreter. We cannot change from static to per-interpreter in a piecemeal fashion. It must be done all at once. |
Right. Changing that is an hard problem :-( See for example bpo-40601 "[C API] Hide static types from the limited C API". I tried once to "free" / reset static types in Py_Finalize(), but it's hard to implement properly :-( |
Mark:
I created bpo-46417 follow-up issue: "[subinterpreters] Clear static types in Py_Finalize()". |
Python 3.9 and 3.10 are concerned by this issue: integer singletons are per-interpreter since Python 3.9. Should Python 3.9 and 3.10 be fixed? "x is 0" is recommended and should be used. For example, the compiler emits a SyntaxWarning: $ python3.9
>>> x=0
>>> x is 0
<stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
True I propose to only fix the main branch and so close the issue. |
This wasn't closed. Is fixing this still targeted for 3.11? In that case it should probably be made a release blocker. If not, the label should be changed to 3.12. @vstinner @markshannon @ericsnowcurrently |
@markshannon fixed the issue with acc89db This issue can now be closed, no? Or is there a remaining issue?
I implemented that in issue #90575. |
The array of small ints got moved again, it's now in pycore_global_objects.h. I will close this issue. |
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: