Issue #13454: Fix a crash when deleting an iterator created by itertools.tee()

if all other iterators were very advanced before.
This commit is contained in:
Serhiy Storchaka 2013-01-25 13:31:05 +02:00
parent 7ee79a2823
commit b09ec9b618
3 changed files with 31 additions and 1 deletions

View file

@ -906,6 +906,14 @@ class TestBasicOps(unittest.TestCase):
del a
self.assertRaises(ReferenceError, getattr, p, '__class__')
# Issue 13454: Crash when deleting backward iterator from tee()
def test_tee_del_backward(self):
forward, backward = tee(xrange(20000000))
for i in forward:
pass
del backward
def test_StopIteration(self):
self.assertRaises(StopIteration, izip().next)