[Python-Dev] Fwd: [Python-checkins] r43358 - python/trunk/Modules/itertoolsmodule.c

Tim Peters tim.peters at gmail.com
Wed Mar 29 02:26:27 CEST 2006


[Thomas Wouters]
...
> not to mention avoiding finalizers on other builtin objects. (None seem to have
> them at the moment, they all do their stuff in tp_dealloc,

Right, generators are the only exception now (and there were no
exceptions before 2.5).

> which I guess doesn't allow objects to reincarnate themselves.)

This is the actual rule:  tp_dealloc must not do anything that could
confuse cyclic gc <0.5 wink>.  I'm afraid that's the best writeup
there is.  If you have a few spare weeks, try to figure out exactly
why subtype_dealloc() does what it does ;-)

> ...
> I'll see about fixing the Python code to avoid or explicitly break the
> cycles.

Or giving gc more smarts about generators specifically (see Phillip's msg).

> Maybe we can patch regrtest.py to take into account uncollectable
> cycles, so that it could report them separately from refleaks. I'm going to
> think about all this first, though.
>
> Hrrm-hrrm'ly y'rs,
> --
> Hi! I'm a finalizer virus! copy me into your tp_del slot to help me spread!

LOL!  Nice variation.


More information about the Python-Dev mailing list