[Python-checkins] cpython (2.7): Optimize the test for issue #13454.

serhiy.storchaka python-checkins at python.org
Sat Jan 26 10:56:34 CET 2013


http://hg.python.org/cpython/rev/4ee8d38398d4
changeset:   81744:4ee8d38398d4
branch:      2.7
parent:      81737:5970c90dd8d1
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sat Jan 26 11:51:42 2013 +0200
summary:
  Optimize the test for issue #13454.
Now it requires almost 4x less memory and is almost 2x faster.

files:
  Lib/test/test_itertools.py |  6 ++----
  1 files changed, 2 insertions(+), 4 deletions(-)


diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -908,10 +908,8 @@
 
     # 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
-
+        forward, backward = tee(repeat(None, 20000000))
+        any(forward)  # exhaust the iterator
         del backward
 
     def test_StopIteration(self):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list