Antoine Pitrou <pit...@free.fr> added the comment:

> 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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9141>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to