[pypy-svn] r16288 - pypy/dist/pypy/module/__builtin__

ale at codespeak.net ale at codespeak.net
Tue Aug 23 17:09:43 CEST 2005


Author: ale
Date: Tue Aug 23 17:09:40 2005
New Revision: 16288

Modified:
   pypy/dist/pypy/module/__builtin__/app_functional.py
Log:
make sure to exhaust reverse iterator if the underlying sequence shrinks to less than the remaining items

Modified: pypy/dist/pypy/module/__builtin__/app_functional.py
==============================================================================
--- pypy/dist/pypy/module/__builtin__/app_functional.py	(original)
+++ pypy/dist/pypy/module/__builtin__/app_functional.py	Tue Aug 23 17:09:40 2005
@@ -362,6 +362,8 @@
         return self
 
     def next(self):
+        if self.remaining > len(self.seq):
+            self.remaining = 0
         i = self.remaining
         if i > 0:
             i -= 1
@@ -371,4 +373,6 @@
         raise StopIteration
 
     def __len__(self):
+        if self.remaining > len(self.seq):
+            self.remaining = 0
         return self.remaining



More information about the Pypy-commit mailing list