[issue21321] itertools.islice() doesn't release reference to the source iterator when the slice is exhausted

Anton Afanasyev report at bugs.python.org
Tue Apr 29 08:27:03 CEST 2014


Anton Afanasyev added the comment:

Hi Antoine,
my test works for me. It can be either
>>> a = [1, 2, 3]
or
>>> a = iter([1, 2, 3])
, no matter: both objects will be +1 referenced after taking
>>> b = islice(a, 1)
. 
My test failed without patch and passed with one.

But your test is more straightforward, thanks.
Attaching patches with your test.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21321>
_______________________________________


More information about the Python-bugs-list mailing list