diff options
author | Victor Stinner <vstinner@python.org> | 2021-06-23 15:47:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 15:47:33 (GMT) |
commit | 5ed7827b1620f5b3729bc9767158d24a33863fa9 (patch) | |
tree | b319c77a89064b6f2fab1345a6c3fb1c3f3bf072 /Python/import.c | |
parent | fcde2c6a8c99a56576b25733d5cc60bce6d51f46 (diff) | |
download | cpython-5ed7827b1620f5b3729bc9767158d24a33863fa9.zip cpython-5ed7827b1620f5b3729bc9767158d24a33863fa9.tar.gz cpython-5ed7827b1620f5b3729bc9767158d24a33863fa9.tar.bz2 |
bpo-44441: _PyImport_Fini2() resets PyImport_Inittab (GH-26874) (GH-26878)
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/import.c')
-rw-r--r-- | Python/import.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c index 55fbe41..1ec7553 100644 --- a/Python/import.c +++ b/Python/import.c @@ -296,6 +296,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; |