Author: Mark Young <[email protected]>
Branch: 33_fix_itertools
Changeset: r84042:dfeff15ecc62
Date: 2016-04-25 02:05 -0400
http://bitbucket.org/pypy/pypy/changeset/dfeff15ecc62/

Log:    Fix infinite loop bug in reduce.

diff --git a/pypy/module/itertools/interp_itertools.py 
b/pypy/module/itertools/interp_itertools.py
--- a/pypy/module/itertools/interp_itertools.py
+++ b/pypy/module/itertools/interp_itertools.py
@@ -846,6 +846,8 @@
             if node.w_obj is not None:
                 list_w.append(node.w_obj)
                 node = node.w_next
+            else:
+                break
         space = self.space
         if list_w:
             return self.space.newtuple([space.type(self),
@@ -917,8 +919,7 @@
                                     self.space.newtuple([
                                         self.w_iterator,
                                         self.w_chained_list])
-                                    ])
-        
+                                    ]) 
 
 def W_TeeIterable___new__(space, w_subtype, w_iterable, w_chained_list=None):
     if isinstance(w_iterable, W_TeeIterable):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to