[issue35983] tp_dealloc trashcan shouldn't be called for subclasses
Serhiy Storchaka
report at bugs.python.org
Thu Mar 28 02:55:54 EDT 2019
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
In your example you can add
PyTypeObject *tp = Py_TYPE(self);
Py_TYPE(self) = &PyList_Type;
if (PyType_GetFlags(tp) & Py_TPFLAGS_HEAPTYPE) {
Py_DECREF(tp);
}
before calling PyList_Type.tp_dealloc().
It is possible to add such code directly in PyList_Type.tp_dealloc and other deallocators that use the trashcan mechanism.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35983>
_______________________________________
More information about the Python-bugs-list
mailing list