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

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


http://hg.python.org/cpython/rev/1f57fb5e1e8e
changeset:   81747:1f57fb5e1e8e
parent:      81743:01bbac9369e8
parent:      81746:2258b4d89c9f
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sat Jan 26 11:54:27 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