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

Jeroen Demeyer report at bugs.python.org
Wed Feb 13 15:51:51 EST 2019


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

NOTE: also OrderedDict currently uses trashcan hacking to work around this problem:

    /* Call the base tp_dealloc().  Since it too uses the trashcan mechanism,
     * temporarily decrement trash_delete_nesting to prevent triggering it
     * and putting the partially deallocated object on the trashcan's
     * to-be-deleted-later list.
     */
    --tstate->trash_delete_nesting;
    assert(_tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL);
    PyDict_Type.tp_dealloc((PyObject *)self);
    ++tstate->trash_delete_nesting;

So this seems to be a known problem which deserves to be fixed properly.

----------

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


More information about the Python-bugs-list mailing list