Message209769
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. |
|
Date |
User |
Action |
Args |
2014-01-31 11:41:26 | loewis | set | recipients:
+ loewis, vstinner, larry, bfroehle |
2014-01-31 11:41:26 | loewis | set | messageid: <1391168486.65.0.10873801381.issue17162@psf.upfronthosting.co.za> |
2014-01-31 11:41:26 | loewis | link | issue17162 messages |
2014-01-31 11:41:26 | loewis | create | |
|