[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 12:53:44 CEST 2012


Kristján Valur Jónsson <kristjan at ccpgames.com> added the comment:

Thanks for your comments Jim.
They made me realize that the patch was incomplete.  What is needed are two mutually exclusive flags that override the presence of the tp_del slot.  This addresses your 1) point and is the case for Generators.

I don't think 2 is important.  Does the context of the call matter?  It is merely a question of whether a finalizer will or will not do something trivial.

Finalizers implemented in python can never run from garbage collection.  the potential to do harm is simply too great.  Which is why these extensions are purely the domain of specialized C extensions.  Hence I don't think adding another slot, or allowing self-declared idempotent python finalizers to run during cleanup is a good idea.

----------

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


More information about the Python-bugs-list mailing list