Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 73205:608975eafe86 3.2
Issue #10363: Deallocate global locks in Py_Finalize().
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Sun, 30 Oct 2011 19:13:55 +0100 |
| parents | 125887a41a6f |
| children | 425591f6c2a5 728595c16acd |
line wrap: on
line diff
--- a/Python/import.c Sun Oct 30 14:31:27 2011 +0200 +++ b/Python/import.c Sun Oct 30 19:13:55 2011 +0100 @@ -252,16 +252,6 @@ Py_DECREF(path_hooks); } -void -_PyImport_Fini(void) -{ - Py_XDECREF(extensions); - extensions = NULL; - PyMem_DEL(_PyImport_Filetab); - _PyImport_Filetab = NULL; -} - - /* Locking primitives to prevent parallel imports of the same module in different threads to return with a partially loaded module. These calls are serialized by the global interpreter lock. */ @@ -374,6 +364,21 @@ return Py_None; } +void +_PyImport_Fini(void) +{ + Py_XDECREF(extensions); + extensions = NULL; + PyMem_DEL(_PyImport_Filetab); + _PyImport_Filetab = NULL; +#ifdef WITH_THREAD + if (import_lock != NULL) { + PyThread_free_lock(import_lock); + import_lock = NULL; + } +#endif +} + static void imp_modules_reloading_clear(void) {
