summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS5
-rw-r--r--Python/import.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 6f2cd12..a2204dd 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -213,6 +213,11 @@ Tools/Demos
if Argument Clinic processes the same symbol multiple times, and it's emitted
at the end of all processing rather than immediately after the first use.
+C API
+-----
+
+- Issue #23998: PyImport_ReInitLock() now checks for lock allocation error
+
What's New in Python 3.5.0 alpha 3?
===================================
diff --git a/Python/import.c b/Python/import.c
index 46c6b53..999da37 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -209,8 +209,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();