Author pitrou
Recipients Anton.Afanasyev, pitrou, rhettinger
Date 2014-04-28.19:54:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398714896.32.0.230266649653.issue21321@psf.upfronthosting.co.za>
In-reply-to
Content
Anton, the test is wrong: it is taking a reference to the iterable object (the list), not the iterator.

To check the reference to the original iterator is released, something like this would work:

>>> import itertools, weakref
>>> it = (x for x in (1, 2))
>>> wr = weakref.ref(it)
>>> it = itertools.islice(it, 1)
>>> wr() is None
False
>>> list(it)
[1]
>>> wr() is None  # returns True with the patch, False without
True
History
Date User Action Args
2014-04-28 19:54:56pitrousetrecipients: + pitrou, rhettinger, Anton.Afanasyev
2014-04-28 19:54:56pitrousetmessageid: <1398714896.32.0.230266649653.issue21321@psf.upfronthosting.co.za>
2014-04-28 19:54:56pitroulinkissue21321 messages
2014-04-28 19:54:56pitroucreate