Closed
Description
Feature or enhancement
There are a few pieces to this:
- Add a
Py_mod_gil
slot, as described in PEP 703, that multi-phase init modules can use to indicate that they support free-threading. - Add a
PyModule_ExperimentalSetGIL()
function (discussed here) that single-phase init modules can use in place ofPy_mod_gil
. - Mark all built-in modules as free-threading compatible with one of the above mechanisms.
- Enable the GIL while loading a C module and leave it permanently enabled if the module does not declare free-threading compatibility.
1-3 are addressed in gh-116882; 4 will be addressed in a separate PR.
Linked PRs
- gh-116322: Add Py_mod_gil module slot #116882
- gh-116322: Enable the GIL while loading C extension modules #118560
- gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL #118645
- gh-116322: Fix typo in the #ifdef check #122268
- gh-116322: Fix typo in moduleobject.c #122282
- [3.13] gh-116322: Fix typo in the GH-ifdef check (GH-122268) #122284
Metadata
Metadata
Assignees
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
PYTHON_GIL=0
or-X gil=0
#116338swtaarrs commentedon Mar 11, 2024
What warning category should this issue?
ImportWarning
sounds like a good fit at first, but it's ignored by the default warning filters, which we don't want. Of the categories not ignored by default,RuntimeWarning
seems like the best fit to me.[-]Implement `Py_mod_gil` slot for free-threading-safe extensions[/-][+]Allow C extensions to declare compatibility with free-threading[/+]gh-116322: Add Py_mod_gil module slot (#116882)
pythongh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Mod…
18 remaining items