This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Jeremy.Hylton
Recipients Jeremy.Hylton, amaury.forgeotdarc, brian.curtin, christian.heimes, ezio.melotti, gvanrossum, tim.peters
Date 2010-02-19.05:23:06
SpamBayes Score 7.882869e-09
Marked as misclassified No
Message-id <1266556988.3.0.0322229542801.issue1540@psf.upfronthosting.co.za>
In-reply-to
Content
One last thought on this bug.  The problem is that after we try to delete garbage, we really can't know much about the state of the objects in the finalizers list.  If any of the objects that are cleared end up causing a finalizer to run, then any of the objects in the finalizers list may be reachable again.  One possibility is to do nothing with the objects in the finalizers list if there was any garbage to delete.  That means objects with finalizers would be harder to get to gc.collect()--for example, you'd need to call gc.collect() twice in a row.  The first time to clear garbage, the second time to handle unreachable objects with finalizers.  Or the GC could run a second time if garbage was cleared and finalizers was non-empty.

A more complicated possibility would be to track some object state about when a finalizer was run.  If any of the objects in finalizers had a finalizer that ran while garbage was cleared, we could skip the finalizers list.  I don't know how to implement this, since an arbitrary C type could run Python code in tp_dealloc without notifying GC.
History
Date User Action Args
2010-02-19 05:23:08Jeremy.Hyltonsetrecipients: + Jeremy.Hylton, gvanrossum, tim.peters, amaury.forgeotdarc, christian.heimes, ezio.melotti, brian.curtin
2010-02-19 05:23:08Jeremy.Hyltonsetmessageid: <1266556988.3.0.0322229542801.issue1540@psf.upfronthosting.co.za>
2010-02-19 05:23:06Jeremy.Hyltonlinkissue1540 messages
2010-02-19 05:23:06Jeremy.Hyltoncreate