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:19:31 +02:00
parent 2f2dd992a3
commit a3e9128aba
3 changed files with 31 additions and 1 deletions

View file

@ -930,6 +930,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(range(20000000))
for i in forward:
pass
del backward
def test_StopIteration(self):
self.assertRaises(StopIteration, next, zip())