Skip to content
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

gh-99113: Add a check for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED #104206

Merged
Prev Previous commit
Next Next commit
Add a NEWS entry.
  • Loading branch information
ericsnowcurrently committed May 5, 2023
commit e2ddc272382d274c9a4b9bdcc2355073da049591
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Multi-phase init extension modules may now indicate that they support
running in subinterpreters that have their own GIL. This is done by using
``Py_MOD_PER_INTERPRETER_GIL_SUPPORTED`` as the value for the
``Py_mod_multiple_interpreters`` module def slot. Otherwise the module, by
default, cannot be imported in such subinterpreters. (This does not affect
the main interpreter or subinterpreters that do not have their own GIL.) In
addition to the isolation that multi-phase init already normally requires,
support for per-interpreter GIL involves one additional constraint:
thread-safety. If the module has external (linked) dependencies and those
libraries have any state that isn't thread-safe then the module must do the
additional work to add thread-safety. This should be an uncommon case.