diff options
author | Christian Heimes <christian@python.org> | 2015-04-19 21:12:14 +0200 |
---|---|---|
committer | Christian Heimes <christian@python.org> | 2015-04-19 21:12:14 +0200 |
commit | 6a3f79a989f15c4b13fdfaf677d084a98f7d9741 (patch) | |
tree | 65d4419a06f1201b23b257328a8bbecf47d29849 /Python/import.c | |
parent | 9c5e722bd4d61b881333a84c9cca6e5a61c89015 (diff) | |
parent | 6e897c7b0bdd3488cea9f9869122e2f67db8f02e (diff) | |
download | cpython-6a3f79a989f15c4b13fdfaf677d084a98f7d9741.tar.gz |
Issue #23998: PyImport_ReInitLock() now checks for lock allocation error
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c index 7ee7ed9bf1..34f4fd504d 100644 --- a/Python/import.c +++ b/Python/import.c @@ -207,8 +207,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(); |