[New-bugs-announce] [issue9141] Allow objects to decide if they can be collected by GC
Kristján Valur Jónsson
report at bugs.python.org
Fri Jul 2 13:30:12 CEST 2010
New submission from Kristján Valur Jónsson <kristjan at ccpgames.com>:
The GC module currently relies only on the presence of a __del__ method to decide if an object can be safely collected at all. Also, there is a special case for generator objects.
This patch allows any object to call an api during its traversal,
PyObject_GC_Collectable(), to indicate whether it is fit to be collected at this time, overriding any presence of a __del__ method or not.
This mechanism is being put in place in stackless python 2.7 because tasklets cannot always be collected depending on their runtime state, and I thought this might be a useful addition for regular python, especially since there already is such a dynamic special case for generator objects.
----------
components: Interpreter Core
files: gc_collectable.patch
keywords: needs review, patch, patch
messages: 109099
nosy: krisvale
priority: normal
severity: normal
status: open
title: Allow objects to decide if they can be collected by GC
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file17838/gc_collectable.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9141>
_______________________________________
More information about the New-bugs-announce
mailing list