[issue35983] tp_dealloc trashcan shouldn't be called for subclasses

Jeroen Demeyer report at bugs.python.org
Thu Mar 28 05:10:13 EDT 2019


Jeroen Demeyer <J.Demeyer at UGent.be> added the comment:

> It disables the trashcan mechanism

Yes, it disables the trashcan in some cases. But only when using the trashcan mechanism would probably crash CPython anyway due to a double deallocation. So at the very least, PR 11841 improves things from "crashing whenever the trashcan is used" to "crashing on stack overflows".

Do you have a real example where PR 11841 actually makes things *worse*?

> and does not provide other mechanism for solving that problem.

The recommended thing to do is that the subclass also implements the trashcan. See OrderedDict for an example: both the base class "dict" and the subclass "OrderedDict" use the trashcan.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35983>
_______________________________________


More information about the Python-bugs-list mailing list