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.
This commit is contained in:
Victor Stinner 2021-06-23 14:13:27 +02:00 committed by GitHub
parent 019ad62afd
commit 489699ca05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 85 additions and 8 deletions

View file

@ -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;