mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Don't remove instance objects from the GC container set until we are
they are dead. Fixes bug #113812.
This commit is contained in:
parent
e64572bccb
commit
ce20967c2c
1 changed files with 1 additions and 2 deletions
|
@ -490,7 +490,6 @@ instance_dealloc(register PyInstanceObject *inst)
|
||||||
#ifdef Py_TRACE_REFS
|
#ifdef Py_TRACE_REFS
|
||||||
extern long _Py_RefTotal;
|
extern long _Py_RefTotal;
|
||||||
#endif
|
#endif
|
||||||
PyObject_GC_Fini(inst);
|
|
||||||
/* Call the __del__ method if it exists. First temporarily
|
/* Call the __del__ method if it exists. First temporarily
|
||||||
revive the object and save the current exception, if any. */
|
revive the object and save the current exception, if any. */
|
||||||
#ifdef Py_TRACE_REFS
|
#ifdef Py_TRACE_REFS
|
||||||
|
@ -523,7 +522,6 @@ instance_dealloc(register PyInstanceObject *inst)
|
||||||
#ifdef COUNT_ALLOCS
|
#ifdef COUNT_ALLOCS
|
||||||
inst->ob_type->tp_free--;
|
inst->ob_type->tp_free--;
|
||||||
#endif
|
#endif
|
||||||
PyObject_GC_Init((PyObject *)inst);
|
|
||||||
return; /* __del__ added a reference; don't delete now */
|
return; /* __del__ added a reference; don't delete now */
|
||||||
}
|
}
|
||||||
#ifdef Py_TRACE_REFS
|
#ifdef Py_TRACE_REFS
|
||||||
|
@ -535,6 +533,7 @@ instance_dealloc(register PyInstanceObject *inst)
|
||||||
inst->ob_type = NULL;
|
inst->ob_type = NULL;
|
||||||
#endif
|
#endif
|
||||||
#endif /* Py_TRACE_REFS */
|
#endif /* Py_TRACE_REFS */
|
||||||
|
PyObject_GC_Fini(inst);
|
||||||
Py_DECREF(inst->in_class);
|
Py_DECREF(inst->in_class);
|
||||||
Py_XDECREF(inst->in_dict);
|
Py_XDECREF(inst->in_dict);
|
||||||
inst = (PyInstanceObject *) PyObject_AS_GC(inst);
|
inst = (PyInstanceObject *) PyObject_AS_GC(inst);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue