]> 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:42 +0000 (21:08 +0200)
committerChristian Heimes <christian@python.org>
Sun, 19 Apr 2015 19:08:42 +0000 (21:08 +0200)
Misc/NEWS
Python/import.c

index ae04f59ac24b617ea2f0fd80e889cb4b2c4ec7e1..83666278a8da4a34e45b24f462e03c9c76f2315a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -32,6 +32,11 @@ Library
 - Issue #23365: Fixed possible integer overflow in
   itertools.combinations_with_replacement.
 
+C API
+-----
+
+- Issue #23998: PyImport_ReInitLock() now checks for lock allocation error
+
 
 What's New in Python 3.3.6?
 ===========================
index 26f82cf29b455ac215847114ff6101d325b8658d..b0b2405ab8b8fe69568bc5a58c70dc298099f681 100644 (file)
@@ -199,8 +199,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");
+        }
+    }
     if (import_lock_level > 1) {
         /* Forked as a side effect of import */
         long me = PyThread_get_thread_ident();