summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-06-23 15:47:38 (GMT)
committerGitHub <noreply@github.com>2021-06-23 15:47:38 (GMT)
commitece3841d3ddf38875b997eb919488cbb911a66e2 (patch)
tree8368c9c92ded7dc8d7f7878d94d4a72689ae8463 /Python
parent88a3342314c8b9ff40a2b6fd4759cfbf64712c67 (diff)
downloadcpython-ece3841d3ddf38875b997eb919488cbb911a66e2.zip
cpython-ece3841d3ddf38875b997eb919488cbb911a66e2.tar.gz
cpython-ece3841d3ddf38875b997eb919488cbb911a66e2.tar.bz2
bpo-44441: _PyImport_Fini2() resets PyImport_Inittab (GH-26874) (GH-26877)
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. (cherry picked from commit 489699ca05bed5cfd10e847d8580840812b476cd)
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;