summaryrefslogtreecommitdiffstats
path: root/Objects/classobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/classobject.c')
-rw-r--r--Objects/classobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 218e031..bb17df1 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -515,6 +515,10 @@ instance_dealloc(register PyInstanceObject *inst)
#ifdef Py_REF_DEBUG
extern long _Py_RefTotal;
#endif
+
+ if (!PyObject_ClearWeakRefs((PyObject *) inst))
+ return;
+
/* Temporarily resurrect the object. */
#ifdef Py_TRACE_REFS
#ifndef Py_REF_DEBUG
@@ -1771,6 +1775,7 @@ PyTypeObject PyInstance_Type = {
(traverseproc)instance_traverse, /* tp_traverse */
0, /* tp_clear */
instance_richcompare, /* tp_richcompare */
+ offsetof(PyInstanceObject, in_weakreflist) /* tp_weaklistoffset */
};