changeset: 95716:d70995cf44b3 branch: 2.7 parent: 95705:df28044b7e14 user: Christian Heimes date: Sun Apr 19 21:08:28 2015 +0200 files: Misc/NEWS Python/import.c description: Issue #23998: PyImport_ReInitLock() now checks for lock allocation error diff -r df28044b7e14 -r d70995cf44b3 Misc/NEWS --- a/Misc/NEWS Sat Apr 18 13:05:19 2015 +0100 +++ b/Misc/NEWS Sun Apr 19 21:08:28 2015 +0200 @@ -263,6 +263,8 @@ 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 -r df28044b7e14 -r d70995cf44b3 Python/import.c --- a/Python/import.c Sat Apr 18 13:05:19 2015 +0100 +++ b/Python/import.c Sun Apr 19 21:08:28 2015 +0200 @@ -337,8 +337,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"); + } + } import_lock_thread = -1; import_lock_level = 0; }