Message101585
| Author |
pitrou |
| Recipients |
benjamin.peterson, kristjan.jonsson, pitrou |
| Date |
2010年03月23日.15:25:38 |
| SpamBayes Score |
3.093866e-05 |
| Marked as misclassified |
No |
| Message-id |
<1269357940.63.0.0128115998533.issue8212@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| 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 |
|