mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
gh-100227: Isolate the Import State to Each Interpreter (gh-101941)
Specific changes: * move the import lock to PyInterpreterState * move the "find_and_load" diagnostic state to PyInterpreterState Note that the import lock exists to keep multiple imports of the same module in the same interpreter (but in different threads) from stomping on each other. Independently, we use a distinct global lock to protect globally shared import state, especially related to loaded extension modules. For now we can rely on the GIL as that lock but with a per-interpreter GIL we'll need a new global lock. The remaining state in _PyRuntimeState.imports will (probably) continue being global. https://github.com/python/cpython/issues/100227
This commit is contained in:
parent
b45d14b886
commit
cf6e7c5e55
5 changed files with 85 additions and 74 deletions
|
|
@ -40,16 +40,6 @@ extern PyTypeObject _PyExc_MemoryError;
|
|||
in accordance with the specification. */ \
|
||||
.autoTSSkey = Py_tss_NEEDS_INIT, \
|
||||
.parser = _parser_runtime_state_INIT, \
|
||||
.imports = { \
|
||||
.lock = { \
|
||||
.mutex = NULL, \
|
||||
.thread = PYTHREAD_INVALID_THREAD_ID, \
|
||||
.level = 0, \
|
||||
}, \
|
||||
.find_and_load = { \
|
||||
.header = 1, \
|
||||
}, \
|
||||
}, \
|
||||
.ceval = { \
|
||||
.perf = _PyEval_RUNTIME_PERF_INIT, \
|
||||
}, \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue