Message217410
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 |
|
Date |
User |
Action |
Args |
2014-04-28 19:54:56 | pitrou | set | recipients:
+ pitrou, rhettinger, Anton.Afanasyev |
2014-04-28 19:54:56 | pitrou | set | messageid: <1398714896.32.0.230266649653.issue21321@psf.upfronthosting.co.za> |
2014-04-28 19:54:56 | pitrou | link | issue21321 messages |
2014-04-28 19:54:56 | pitrou | create | |
|