-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
Disable importing legacy single-phase init extensions within subinterpreters in --disable-gil
build
#117649
Comments
Note that this only relates to legacy subinterpreters (not isolated, created by Raising |
--disable-gil
build--disable-gil
build
…readed build The free-threaded build does not currently support the combination of single-phase init modules and legacy, non-isolated subinterpreters. Note that with isolated interpreters, single-phase init modules already trigger `ImportError`.
…readed build The free-threaded build does not currently support the combination of single-phase init modules and legacy, non-isolated subinterpreters. Note that with isolated interpreters, single-phase init modules already trigger `ImportError`.
You might want use the current mechanism: require Note that there are two ways to implement the limitation:
The first was easier to implement; we might want to switch to the second later. If/when we do, |
… build (#117651) The free-threaded build does not currently support the combination of single-phase init modules and non-isolated subinterpreters. Ensure that `check_multi_interp_extensions` is always `True` for subinterpreters in the free-threaded build so that importing these modules raises an `ImportError`.
…case The test case is currently expected to fail in the free-threaded build. However, it fails before it gets a chance to close the write end of the pipe.
…117780) The test case is currently expected to fail in the free-threaded build. However, it fails before it gets a chance to close the write end of the pipe.
…readed build (python#117651) The free-threaded build does not currently support the combination of single-phase init modules and non-isolated subinterpreters. Ensure that `check_multi_interp_extensions` is always `True` for subinterpreters in the free-threaded build so that importing these modules raises an `ImportError`.
…case (python#117780) The test case is currently expected to fail in the free-threaded build. However, it fails before it gets a chance to close the write end of the pipe.
Feature or enhancement
When importing a single-phase init extension in a subinterpreter, Python will make a shallow copy of the module's dictionary, which can share (non-immortal) objects between interpreters.
This does not work properly in the
--disable-gil
build, and we should disable it by raising anImportError
, at least for now. We can investigate how to support this in the future.There are currently some unit tests for this case. Those tests pass, but that's mostly because they are simple and small changes to things like the GC will cause them to crash.
The underlying problems are not directly related to the GIL, but rather because the GC and our mimalloc integration in the
--disable-gil
build assume that non-immortal objects are isolated by interpreter:tp_traverse
are also reachable from the per-interpreter mimalloc heaps. Violating this assumption can cause flags to be set to an inconsistent state.Linked PRs
The text was updated successfully, but these errors were encountered: