Bug report
We need to handle the case where allocate_weakref returns NULL due to an out-of-memory error.
|
PyWeakReference *newref = allocate_weakref(type, obj, callback); |
|
insert_weakref(newref, list); |
|
UNLOCK_WEAKREFS(obj); |
|
return newref; |
|
} |
|
else { |
|
// We may not be able to safely allocate inside the lock |
|
PyWeakReference *newref = allocate_weakref(type, obj, callback); |
|
LOCK_WEAKREFS(obj); |
|
insert_weakref(newref, list); |
|
UNLOCK_WEAKREFS(obj); |
|
return newref; |
Linked PRs
Bug report
We need to handle the case where
allocate_weakrefreturnsNULLdue to an out-of-memory error.cpython/Objects/weakrefobject.c
Lines 428 to 439 in dc03ce7
Linked PRs
allocate_weakrefreturning NULL #121653allocate_weakrefreturning NULL (GH-121653) #121721