summaryrefslogtreecommitdiffstats
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2022-11-12 00:06:05 (GMT)
committerGitHub <noreply@github.com>2022-11-12 00:06:05 (GMT)
commit7f3a4b967cfb1596a3fda6c34f900f8586b16700 (patch)
treec4381e2cdfce4f636d2eff0288bf5ec59c74c44d /Python/pylifecycle.c
parent67807cfc87135fdce4992d38d2ffe3e44747e73b (diff)
downloadcpython-7f3a4b967cfb1596a3fda6c34f900f8586b16700.zip
cpython-7f3a4b967cfb1596a3fda6c34f900f8586b16700.tar.gz
cpython-7f3a4b967cfb1596a3fda6c34f900f8586b16700.tar.bz2
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
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 39e54c1..44f8442 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -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;