Closed
Description
In CPython, we store (persistent) runtime data in several locations. (See https://github.com/ericsnowcurrently/multi-core-python/wiki/3-CPython's-Runtime#cpythons-run-time-data.)
The state of each interpreter (PyInterpreterState
) encapsulates the data which is unique to that interpreter and isolated from other interpreters. That isolation is important for the proper operation of multiple interpreters in a process, and will be critical for a per-interpreter GIL, AKA PEP 684 (assuming it gets approved). There are still a number of gaps in isolation which we will address here.
The deficiencies may be categorized by the following:
- shared runtime state (
_PyRuntimeState
) conceptually better suited to each interpreter - shared runtime state currently protected by the GIL
- shared global variables that shouldn't be shared
- shared global variables currently protected by the GIL
Linked PRs
- gh-100227: Port dup3_works to the module state variable. #100262
- gh-100227: Isolate the Import State to Each Interpreter #101941
- gh-100227: Move the dtoa State to PyInterpreterState #102331
- gh-100227: Move _str_replace_inf to PyInterpreterState #102333
- gh-100227: Move func_state.next_version to PyInterpreterState #102334
- gh-100227: Move next_keys_version to PyInterpreterState #102335
- gh-100227: Move dict_state.global_version to PyInterpreterState #102338
- gh-100227: Move the Dict of Interned Strings to PyInterpreterState #102339
- GH-100227: cleanup initialization of global interned dict #102682
- gh-100227: Make the Global Interned Dict Safe for Isolated Interpreters #102858
- gh-100227: Make the Global Interned Dict Safe for Isolated Interpreters #102925
- gh-100227: Make the Global PyModuleDef Cache Safe for Isolated Interpreters #102938
- gh-100227: Revert "gh-100227: Make the Global Interned Dict Safe for Isolated Interpreters (gh-102925)" #103063
- gh-100227: Make the Global PyModuleDef Cache Safe for Isolated Interpreters #103084
- gh-100227: Fix Cleanup of the Extensions Cache #103150
- gh-100227: Use an Array for _PyRuntime's Set of Locks During Init #103315
- gh-100227: Add a Granular Lock for _PyRuntime.imports.extensions.dict #103460
- gh-100227: Only Use deepfreeze for the Main Interpreter #103794
- gh-100227: Add Missing Locks for Specific Global Runtime State #105470
- gh-100227: Lock Around Use of the Global "atexit" State #105514
- gh-100227: Lock Around Adding Global Audit Hooks #105515
- gh-100227: Lock Around Modification of the Global Allocators State #105516
- [3.12] gh-100227: Lock Around Use of the Global "atexit" State (gh-105514) #105517
- [3.12] gh-100227: Lock Around Adding Global Audit Hooks (gh-105515) #105525
- [3.12] gh-100227: Lock Around Modification of the Global Allocators State (gh-105516) #105532
- gh-105766: Add Locking Around Custom Allocators #105619
Metadata
Metadata
Assignees
Labels
Projects
Status
Done