Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 418fd74

Browse files
committed
Issue #23998: PyImport_ReInitLock() now checks for lock allocation error
1 parent e5a853c commit 418fd74

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ Library
3232
- Issue #23365: Fixed possible integer overflow in
3333
itertools.combinations_with_replacement.
3434

35+
C API
36+
-----
37+
38+
- Issue #23998: PyImport_ReInitLock() now checks for lock allocation error
39+
3540

3641
What's New in Python 3.3.6?
3742
===========================

Python/import.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,12 @@ _PyImport_ReleaseLock(void)
199199
void
200200
_PyImport_ReInitLock(void)
201201
{
202-
if (import_lock != NULL)
202+
if (import_lock != NULL) {
203203
import_lock = PyThread_allocate_lock();
204+
if (import_lock == NULL) {
205+
Py_FatalError("PyImport_ReInitLock failed to create a new lock");
206+
}
207+
}
204208
if (import_lock_level > 1) {
205209
/* Forked as a side effect of import */
206210
long me = PyThread_get_thread_ident();

0 commit comments

Comments
 (0)