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

Thomas Wouters thomas at python.org
Mon Mar 27 23:21:40 CEST 2006


On 3/27/06, Raymond Hettinger <raymond.hettinger at verizon.net> wrote:
>
> > Modified:
> >   python/trunk/Modules/itertoolsmodule.c
> > Log:
> >
> > Make itertools.tee and its internal teedataobject participate in GC.
> This
> > alone does not solve the leak in test_generators, unfortunately, but it
> is
> > part of test_generators' problem and it does solve other cycles.
>
> Thanks for getting this in.
>
> To get the leak in test_generators, I think you make need to add GC to the
> teeobject as well as the teedataobject.


The teeobject has GC (hence the word 'and' in 'itertools.tee and its
internal teedataobject' ;-) The problem with test_generators is that this
also leaks:

def leak():
    def gen():
        while True:
            yield g
    g = gen()

leak()

It doesn't leak in 2.4. I'm using a little shell script to work backwards
through the 2.5 changes to find out which one introduced this, although I
somehow suspect it's the coroutine stuff... ;P

--
Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060327/20b24644/attachment.html 


More information about the Python-Dev mailing list