[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc

Martin v. Löwis report at bugs.python.org
Fri Jan 31 12:41:26 CET 2014


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 <report at bugs.python.org>
<http://bugs.python.org/issue17162>
_______________________________________


More information about the Python-bugs-list mailing list