[issue9141] Allow objects to decide if they can be collected by GC

Antoine Pitrou report at bugs.python.org
Tue Apr 17 12:33:13 CEST 2012


Antoine Pitrou <pitrou at free.fr> added the comment:

> Surely, if these objects define non-trivial 'close' members, they must 
> not be called during garbage collection.

Define "non-trivial". There are various tests for it in test_io.

Not ending up in gc.garbage is *by design*. Making file objects uncollectable as soon as they appear in a reference cycle would be a serious regression. That's why the cleanup is done in tp_dealloc instead of having a __del__.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9141>
_______________________________________


More information about the Python-bugs-list mailing list