[Python-checkins] cpython (merge 3.2 -> 3.3): Optimize the test for issue #13454.

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


http://hg.python.org/cpython/rev/2258b4d89c9f
changeset:   81746:2258b4d89c9f
branch:      3.3
parent:      81741:dcbc16afd6bc
parent:      81745:d391b2849a51
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sat Jan 26 11:53:17 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
@@ -1269,10 +1269,8 @@
 
     # 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
-
+        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