mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
PEP 205, Weak References -- initial checkin.
This commit is contained in:
parent
2de7471d69
commit
41deb1efc2
9 changed files with 1158 additions and 4 deletions
|
@ -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 */
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue