mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Handle more memory allocation failures without crashing.
This commit is contained in:
parent
33722aec57
commit
d12bd012a6
5 changed files with 38 additions and 8 deletions
|
@ -267,6 +267,8 @@ find_key(int key, void *value)
|
|||
struct key *p;
|
||||
long id = PyThread_get_thread_ident();
|
||||
|
||||
if (!keymutex)
|
||||
return NULL;
|
||||
PyThread_acquire_lock(keymutex, 1);
|
||||
for (p = keyhead; p != NULL; p = p->next) {
|
||||
if (p->id == id && p->key == key)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue