Issue #23998: PyImport_ReInitLock() now checks for lock allocation error

This commit is contained in:
Christian Heimes 2015-04-19 21:15:02 +02:00
commit 1a084a882b
2 changed files with 10 additions and 1 deletions

View file

@ -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();