diff options
author | Victor Stinner <vstinner@python.org> | 2021-06-23 14:13:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 14:13:27 +0200 |
commit | 489699ca05bed5cfd10e847d8580840812b476cd (patch) | |
tree | f58b7493648a430be755b5bc5a788923c8774e62 /Python/import.c | |
parent | 019ad62afd20e80c74f879aa716e339b992a0bb9 (diff) | |
download | cpython-git-489699ca05bed5cfd10e847d8580840812b476cd.tar.gz |
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/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 c4878c628b..7301fccb9f 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; |