Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5bb893c

Browse files
Optimize the test for issue #13454.
Now it requires almost 4x less memory and is almost 2x faster.
1 parent ace3ad3 commit 5bb893c

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

Lib/test/test_itertools.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -932,10 +932,8 @@ def irange(n):
932932

933933
# Issue 13454: Crash when deleting backward iterator from tee()
934934
def test_tee_del_backward(self):
935-
forward, backward = tee(range(20000000))
936-
for i in forward:
937-
pass
938-
935+
forward, backward = tee(repeat(None, 20000000))
936+
any(forward) # exhaust the iterator
939937
del backward
940938

941939
def test_StopIteration(self):

0 commit comments

Comments
 (0)