Skip to content

Commit fd1fa03

Browse files
committed
add assert for gil build
1 parent 190af33 commit fd1fa03

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Include/internal/pycore_weakref.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ extern "C" {
4545

4646
#define FT_CLEAR_WEAKREFS(obj, weakref_list) \
4747
do { \
48+
assert(Py_REFCNT(obj) == 0); \
4849
if (weakref_list != NULL) { \
4950
PyObject_ClearWeakRefs(obj); \
5051
} \

Objects/classobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "pycore_object.h"
88
#include "pycore_pyerrors.h"
99
#include "pycore_pystate.h" // _PyThreadState_GET()
10-
#include "pycore_weakref.h"
10+
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
1111

1212

1313
#include "clinic/classobject.c.h"

0 commit comments

Comments
 (0)