[Python-checkins] cpython (merge 3.3 -> 3.4): Issue #23998: PyImport_ReInitLock() now checks for lock allocation error

christian.heimes python-checkins at python.org
Sun Apr 19 21:15:49 CEST 2015


https://hg.python.org/cpython/rev/e0bd083fc9c1
changeset:   95718:e0bd083fc9c1
branch:      3.4
parent:      95714:d2edac11d57c
parent:      95717:7d7bf5c34d7e
user:        Christian Heimes <christian at python.org>
date:        Sun Apr 19 21:12:14 2015 +0200
summary:
  Issue #23998: PyImport_ReInitLock() now checks for lock allocation error

files:
  Misc/NEWS       |  5 +++++
  Python/import.c |  6 +++++-
  2 files changed, 10 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -201,6 +201,11 @@
 - Issue #23686: Update OS X 10.5 installer and Windows builds to use
   OpenSSL 1.0.2a.
 
+C API
+-----
+
+- Issue #23998: PyImport_ReInitLock() now checks for lock allocation error
+
 
 What's New in Python 3.4.3?
 ===========================
diff --git a/Python/import.c b/Python/import.c
--- a/Python/import.c
+++ b/Python/import.c
@@ -207,8 +207,12 @@
 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();

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list