Skip to content

Commit c02343c

Browse files
committed
Unconditionally clear weak refs in ctypdescr_dealloc to avoid race in CPython internals.
see python/cpython#135607
1 parent 0e5d59e commit c02343c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/c/_cffi_backend.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,7 @@ static void
517517
ctypedescr_dealloc(CTypeDescrObject *ct)
518518
{
519519
PyObject_GC_UnTrack(ct);
520-
if (ct->ct_weakreflist != NULL)
521-
PyObject_ClearWeakRefs((PyObject *) ct);
520+
PyObject_ClearWeakRefs((PyObject *) ct);
522521

523522
if (ct->ct_unique_key != NULL) {
524523
/* delete the weak reference from unique_cache */

0 commit comments

Comments
 (0)