From: Christian Heimes Date: Sun, 19 Apr 2015 19:08:28 +0000 (+0200) Subject: Issue #23998: PyImport_ReInitLock() now checks for lock allocation error X-Git-Tag: v2.7.10rc1~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3ce7873fddef05ecd6c5da2d5bd40206fee3805c;p=thirdparty%2FPython%2Fcpython.git Issue #23998: PyImport_ReInitLock() now checks for lock allocation error --- diff --git a/Misc/NEWS b/Misc/NEWS index 7577f00e1624..b06d5b198a44 100644 --- 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. diff --git a/Python/import.c b/Python/import.c index 92363b39376e..e47ce633ca56 100644 --- a/Python/import.c +++ b/Python/import.c @@ -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; }