Message158540
| Author |
pitrou |
| Recipients |
Jim.Jewett, amaury.forgeotdarc, asvetlov, dstanek, kristjan.jonsson, loewis, pitrou, rhettinger, stutzbach, tim.peters |
| Date |
2012年04月17日.10:48:30 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1334659650.3338.9.camel@localhost.localdomain> |
| In-reply-to |
<1334659080.54.0.88058540041.issue9141@psf.upfronthosting.co.za> |
| Content |
> I _think_ the only python related things you can do from tp_clear() is
> Py_DECREF(), this is what I mean by trivial.
Well, Py_DECREF is not trivial at all, since it can invoke arbitrary
Python code (through e.g. weakref callbacks, or by releasing the GIL).
Therefore, I would say any code is allowed from tp_clear :-)
> If file.close() can be an arbitrary python method, then it can no more
> be called from gc, than an object's __del__ method. This would not be
> a regression, this would be a fact of life.
I don't believe it. I don't see what's magical about being called by the
gc. Again, a Py_DECREF in tp_dealloc can invoke arbitrary Python code. |
|