Message101585
Indeed. The io module has had to circumvent this and uses the following snippet when resurrecting an instance of a subclass of one of its types (see iobase_dealloc() in Modules/_io/iobase.c):
/* When called from a heap type's dealloc, the type will be
decref'ed on return (see e.g. subtype_dealloc in typeobject.c). */
if (PyType_HasFeature(Py_TYPE(self), Py_TPFLAGS_HEAPTYPE))
Py_INCREF(Py_TYPE(self));
return;
I agree it would be nice to have an automatic way of handling this. I don't see an obvious solution, though. |
|
Date |
User |
Action |
Args |
2010-03-23 15:25:40 | pitrou | set | recipients:
+ pitrou, kristjan.jonsson, benjamin.peterson |
2010-03-23 15:25:40 | pitrou | set | messageid: <1269357940.63.0.0128115998533.issue8212@psf.upfronthosting.co.za> |
2010-03-23 15:25:38 | pitrou | link | issue8212 messages |
2010-03-23 15:25:38 | pitrou | create | |
|