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

Skip to content

Commit 1a084a8

Browse files
committed
Issue #23998: PyImport_ReInitLock() now checks for lock allocation error
2 parents db46fea + e0ac2be commit 1a084a8

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
@@ -213,6 +213,11 @@ Tools/Demos
213213
if Argument Clinic processes the same symbol multiple times, and it's emitted
214214
at the end of all processing rather than immediately after the first use.
215215

216+
C API
217+
-----
218+
219+
- Issue #23998: PyImport_ReInitLock() now checks for lock allocation error
220+
216221

217222
What's New in Python 3.5.0 alpha 3?
218223
===================================

Python/import.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,12 @@ _PyImport_ReleaseLock(void)
209209
void
210210
_PyImport_ReInitLock(void)
211211
{
212-
if (import_lock != NULL)
212+
if (import_lock != NULL) {
213213
import_lock = PyThread_allocate_lock();
214+
if (import_lock == NULL) {
215+
Py_FatalError("PyImport_ReInitLock failed to create a new lock");
216+
}
217+
}
214218
if (import_lock_level > 1) {
215219
/* Forked as a side effect of import */
216220
long me = PyThread_get_thread_ident();

0 commit comments

Comments
 (0)