[issue9141] Allow objects to decide if they can be collected by GC
Kristján Valur Jónsson
report at bugs.python.org
Fri Apr 6 22:52:51 CEST 2012
Kristján Valur Jónsson <kristjan at ccpgames.com> added the comment:
typeobject.c:
TPSLOT("__del__", tp_del, slot_tp_del, NULL, ""),
I'm not super-familiar with how typeobjects and slots work, but I imagine that if a type is defined with a __del__ member, then the tp_del slot is automatically filled out. The converse need not be true.
At any rate, the non-zero-ness of tp_del is what gcmodule.c uses to find out if an object has a finaliser. There is a code rudiment present in gcmodule.c, that hints at an earlier time when '__del__' was looked up but that string is not actually used. That can be removed to, eiter as part of this patch or separately since it should be quite uncontroversial.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9141>
_______________________________________
More information about the Python-bugs-list
mailing list