summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-06-23 12:13:27 (GMT)
committerGitHub <noreply@github.com>2021-06-23 12:13:27 (GMT)
commit489699ca05bed5cfd10e847d8580840812b476cd (patch)
treef58b7493648a430be755b5bc5a788923c8774e62 /Python
parent019ad62afd20e80c74f879aa716e339b992a0bb9 (diff)
downloadcpython-489699ca05bed5cfd10e847d8580840812b476cd.zip
cpython-489699ca05bed5cfd10e847d8580840812b476cd.tar.gz
cpython-489699ca05bed5cfd10e847d8580840812b476cd.tar.bz2
bpo-44441: _PyImport_Fini2() resets PyImport_Inittab (GH-26874)
Py_RunMain() now resets PyImport_Inittab to its initial value at exit. It must be possible to call PyImport_AppendInittab() or PyImport_ExtendInittab() at each Python initialization.
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index c4878c6..7301fcc 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -255,6 +255,9 @@ _PyImport_Fini2(void)
PyMemAllocatorEx old_alloc;
_PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
+ // Reset PyImport_Inittab
+ PyImport_Inittab = _PyImport_Inittab;
+
/* Free memory allocated by PyImport_ExtendInittab() */
PyMem_RawFree(inittab_copy);
inittab_copy = NULL;