[Python-Dev] issue 9141, finalizers and gc module

Maciej Fijalkowski fijall at gmail.com
Tue Apr 17 23:29:19 CEST 2012

On Tue, Apr 17, 2012 at 8:30 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:

> On Tue, 17 Apr 2012 17:22:57 +0000
> Kristján Valur Jónsson <kristjan at ccpgames.com> wrote:
> > >
> > > We are all consenting adults. Everything is allowed - you just have to
> live with
> > > the consequences.
> >
> > Well, we specifically decided that objects with __del__ methods that are
> part of a cycle cannot be run.
> > The same reasoning was applied to generators, if they are in a certain
> state.
> > What makes iobase so special that its 'close' method can be run even if
> it is part of a cycle?
> The reason is that making file objects uncollectable when they are part
> of a reference cycle would be a PITA and a serious regression for many
> applications, I think.
> > Why not allow it for all objects, then?
> I'm not the author of the original GC design. Perhaps it was
> deliberately conservative at the time? I think PyPy has a more tolerant
> solution for finalizers in reference cycles, perhaps they can explain it
> here.
> Regards
> Antoine.

PyPy breaks cycles randomly. I think a pretty comprehensive description of
what happens is here:


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120417/d1b00fd3/attachment.html>

More information about the Python-Dev mailing list