[issue8212] A tp_dealloc of a subclassed class cannot resurrect an object

Kristján Valur Jónsson report at bugs.python.org
Sun Apr 15 16:12:52 CEST 2012


Kristján Valur Jónsson <kristjan at ccpgames.com> added the comment:

Another, less hacky but more intrusive, way would be to change the signature of tp_dealloc in a backwards compatible way:
typedef void (*destructor)(PyObject *, int *destroyed);

The destructor can then set the flag pointed to by 'destroyed' to 1 or 0, depending on whether actual destruction took place.  The caller will set the flag to '1' by default.

We could then change all internal destructors to conform, and know that external destructors will continue to work in the old way.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8212>
_______________________________________


More information about the Python-bugs-list mailing list