gh-81057: Move PyImport_Inittab to _PyRuntimeState (gh-99402)

We actually don't move PyImport_Inittab.  Instead, we make a copy that we keep on _PyRuntimeState and use only that after Py_Initialize().  We also prevent folks from modifying PyImport_Inittab (the best we can) after that point.

https://github.com/python/cpython/issues/81057
This commit is contained in:
Eric Snow 2022-11-11 17:06:05 -07:00 committed by GitHub
parent 67807cfc87
commit 7f3a4b967c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 80 additions and 8 deletions

View file

@ -605,6 +605,11 @@ pycore_init_runtime(_PyRuntimeState *runtime,
return status;
}
status = _PyImport_Init();
if (_PyStatus_EXCEPTION(status)) {
return status;
}
status = _PyInterpreterState_Enable(runtime);
if (_PyStatus_EXCEPTION(status)) {
return status;