Antoine Pitrou added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21321>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to