summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2015-04-19 19:08:42 (GMT)
committerChristian Heimes <christian@python.org>2015-04-19 19:08:42 (GMT)
commit418fd74f87756c4312db496db92118bba2c4484a (patch)
tree21287f5643a1f7c044083fb33d28b9b10f84fac0 /Python/import.c
parente5a853c390f76f8d73939138adf70604fe33ca4c (diff)
downloadcpython-418fd74f87756c4312db496db92118bba2c4484a.zip
cpython-418fd74f87756c4312db496db92118bba2c4484a.tar.gz
cpython-418fd74f87756c4312db496db92118bba2c4484a.tar.bz2
Issue #23998: PyImport_ReInitLock() now checks for lock allocation error
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c
index 26f82cf..b0b2405 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -199,8 +199,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();