summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-10-30 18:14:46 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-10-30 18:14:46 (GMT)
commit6fbbc334407904ee344c2b30d346f870031c0371 (patch)
treebbae13d95cb196904716066a9d35d8f899105a50 /Python/import.c
parentc34f5c256a4c528d5d1105deee5eeeac944e4b91 (diff)
parent8db076cf8af4fddfc1e406ec579d559abc53304c (diff)
downloadcpython-6fbbc334407904ee344c2b30d346f870031c0371.zip
cpython-6fbbc334407904ee344c2b30d346f870031c0371.tar.gz
cpython-6fbbc334407904ee344c2b30d346f870031c0371.tar.bz2
Issue #10363: Deallocate global locks in Py_Finalize().
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/Python/import.c b/Python/import.c
index 294eb2b..8e3aa4b 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -268,16 +268,6 @@ _PyImportHooks_Init(void)
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. */
@@ -390,6 +380,21 @@ imp_release_lock(PyObject *self, PyObject *noargs)
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)
{