gh-99113: A Per-Interpreter GIL!#99114
Conversation
|
318 commits, 114 files, 23 reviewers… How are we going to do this? |
Sorry, something went wrong.
We can create a separate PR that just defines a no-op slot Thanks to it, this PR will become a much smaller follow-up. |
Sorry, something went wrong.
Not sure how that happened — I only meant to remove my own request for review... |
Sorry, something went wrong.
Actually, most of the changed files are repetitive, trivial updates of various extension module's PyModuleDef structs. |
Sorry, something went wrong.
Their repetitiveness takes attention from other parts of the diff and requires to constantly scroll through all of them for each inter-file comparison in other parts of the PR. It makes the analysis harder. That's why I proposed to move them out into a separate PR, merge it and update this PR. |
Sorry, something went wrong.
|
I quickly went through and marked all those files as "Viewed", then used the File Filter drop down to hide viewed files. So I've only got 7 files left with non-trivial changes, one of which is the NEWS entry. Looks like the "viewed" state is remembered, but the filter needs to be set each time I go back in. |
Sorry, something went wrong.
|
I had seriously considered splitting this PR up yesterday. I should have listened to myself. 🙂 I'm going to split it up. |
Sorry, something went wrong.
|
I've noted the new PRs above in the PR summary. |
Sorry, something went wrong.
…pythongh-104148) I'll be adding a value to indicate support for per-interpreter GIL in pythongh-99114.

I've split up this PR:
That last one is effectively the superseder of this one.
This is the culmination of PEP 684 (and of my 8-year long multi-core Python project)!
Each subinterpreter may now be created with its own GIL (via
Py_NewInterpreterFromConfig()). If not so configured then the interpreter will share with the main interpreter--the status quo since the subinterpreters were added decades ago. The main interpreter always has its own GIL and subinterpreters fromPy_NewInterpreter()will always share with the main interpreter.This is essentially the correct implementation but it may change here and there before we've reached the end.
We won't merge this until:
I'm merging in other branches that this one relies on, but those will wash out as the other PRs get merged. In the meantime, you can see the actual changes here: https://github.com/python/cpython/compare/main...ericsnowcurrently:per-interpreter-gil-new-bare?expand=1.