mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
GH-124715: Move trashcan mechanism into Py_Dealloc
(GH-132280)
This commit is contained in:
parent
0f23e84cda
commit
44e4c479fb
26 changed files with 88 additions and 196 deletions
|
@ -166,10 +166,7 @@ static void
|
|||
meth_dealloc(PyObject *self)
|
||||
{
|
||||
PyCFunctionObject *m = _PyCFunctionObject_CAST(self);
|
||||
// The Py_TRASHCAN mechanism requires that we be able to
|
||||
// call PyObject_GC_UnTrack twice on an object.
|
||||
PyObject_GC_UnTrack(m);
|
||||
Py_TRASHCAN_BEGIN(m, meth_dealloc);
|
||||
if (m->m_weakreflist != NULL) {
|
||||
PyObject_ClearWeakRefs((PyObject*) m);
|
||||
}
|
||||
|
@ -190,7 +187,6 @@ meth_dealloc(PyObject *self)
|
|||
assert(Py_IS_TYPE(self, &PyCFunction_Type));
|
||||
_Py_FREELIST_FREE(pycfunctionobject, m, PyObject_GC_Del);
|
||||
}
|
||||
Py_TRASHCAN_END;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue