From: Christian Heimes Date: Sun, 19 Apr 2015 19:08:42 +0000 (+0200) Subject: Issue #23998: PyImport_ReInitLock() now checks for lock allocation error X-Git-Tag: v3.5.0a4~2^2^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=418fd74f87756c4312db496db92118bba2c4484a;p=thirdparty%2FPython%2Fcpython.git Issue #23998: PyImport_ReInitLock() now checks for lock allocation error --- diff --git a/Misc/NEWS b/Misc/NEWS index ae04f59ac24b..83666278a8da 100644 --- 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? =========================== diff --git a/Python/import.c b/Python/import.c index 26f82cf29b45..b0b2405ab8b8 100644 --- a/Python/import.c +++ b/Python/import.c @@ -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();