Martin v. Löwis added the comment:

It's certainly possible to write a "proper" dealloc - just call PyObject_Del 
directly. This is correct if the type isn't subclassable, and works if it 
actually isn't subclassed, or if the subclass object can also be released 
through PyObject_Del.

That this has *nobody* noticed yet isn't the case - the OP certainly noticed a 
year ago. Else, the limited API isn't in wide use yet, probably partly because 
it is too limited still for certain extension modules (but it is by design that 
it is limited at all, so that code might require active porting to use it, and 
may not be portable at all in certain cases).

If the typical use case is PyTYPE(self)->tp_free, then the type ought to be a 
heap type, so limiting the implementation to heap types should be sufficient. 
It would be feasible to extend it to non-heaptypes, although I do wonder what 
use case this would allow for.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17162>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to