]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #23998: PyImport_ReInitLock() now checks for lock allocation error
authorChristian Heimes <christian@python.org>
Sun, 19 Apr 2015 19:08:28 +0000 (21:08 +0200)
committerChristian Heimes <christian@python.org>
Sun, 19 Apr 2015 19:08:28 +0000 (21:08 +0200)
Misc/NEWS
Python/import.c

index 7577f00e162408ec58a6e10903ddf03129031350..b06d5b198a443cbca747149902e29780dd89ca1d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -263,6 +263,8 @@ Build
 C API
 -----
 
+- Issue #23998: PyImport_ReInitLock() now checks for lock allocation error
+
 - Issue #22079: PyType_Ready() now checks that statically allocated type has
   no dynamically allocated bases.
 
index 92363b39376ea5483ee71f1a904c5637c0b19886..e47ce633ca5610686c047df0886b1858dede4e31 100644 (file)
@@ -337,8 +337,12 @@ _PyImport_ReleaseLock(void)
 void
 _PyImport_ReInitLock(void)
 {
-    if (import_lock != NULL)
+    if (import_lock != NULL) {
         import_lock = PyThread_allocate_lock();
+        if (import_lock == NULL) {
+            Py_FatalError("PyImport_ReInitLock failed to create a new lock");
+        }
+    }
     import_lock_thread = -1;
     import_lock_level = 0;
 }