[pypy-svn] r4896 - pypy/branch/src-newobjectmodel/pypy/objspace/std

hpk at codespeak.net hpk at codespeak.net
Fri Jun 4 10:29:11 CEST 2004


Author: hpk
Date: Fri Jun  4 10:29:11 2004
New Revision: 4896

Modified:
   pypy/branch/src-newobjectmodel/pypy/objspace/std/iterobject.py
   pypy/branch/src-newobjectmodel/pypy/objspace/std/listobject.py
   pypy/branch/src-newobjectmodel/pypy/objspace/std/typeobject.py
   pypy/branch/src-newobjectmodel/pypy/objspace/std/userobject.py
Log:
NoValue -> OperationError(...)


Modified: pypy/branch/src-newobjectmodel/pypy/objspace/std/iterobject.py
==============================================================================
--- pypy/branch/src-newobjectmodel/pypy/objspace/std/iterobject.py	(original)
+++ pypy/branch/src-newobjectmodel/pypy/objspace/std/iterobject.py	Fri Jun  4 10:29:11 2004
@@ -27,9 +27,9 @@
     try:
         w_item = space.getitem(w_seqiter.w_seq, space.wrap(w_seqiter.index))
     except OperationError, e:
-        if e.match(space, space.w_IndexError):
-            raise NoValue
-        raise
+        if not e.match(space, space.w_IndexError):
+            raise
+        raise OperationError(space, space.w_StopIteration, space.w_None) 
     w_seqiter.index += 1
     return w_item
 

Modified: pypy/branch/src-newobjectmodel/pypy/objspace/std/listobject.py
==============================================================================
--- pypy/branch/src-newobjectmodel/pypy/objspace/std/listobject.py	(original)
+++ pypy/branch/src-newobjectmodel/pypy/objspace/std/listobject.py	Fri Jun  4 10:29:11 2004
@@ -52,7 +52,9 @@
         while True:
             try:
                 w_item = space.next(w_iterator)
-            except NoValue:
+            except OperationError, e:
+                if not e.match(space, space.w_StopIteration):
+                    raise 
                 break  # done
             _ins1(w_list, w_list.ob_size, w_item)
     else:

Modified: pypy/branch/src-newobjectmodel/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/branch/src-newobjectmodel/pypy/objspace/std/typeobject.py	(original)
+++ pypy/branch/src-newobjectmodel/pypy/objspace/std/typeobject.py	Fri Jun  4 10:29:11 2004
@@ -178,11 +178,7 @@
         "Call the next() multimethod."
         mm = self.code.slice().get(self.space)
         args = self.fastlocals_w
-        try:
-            return mm(*args)
-        except NoValue:
-            raise OperationError(self.space.w_StopIteration,
-                                 self.space.w_None)
+        return mm(*args)
 
 class NonZeroMmFrame(eval.Frame):
     def run(self):

Modified: pypy/branch/src-newobjectmodel/pypy/objspace/std/userobject.py
==============================================================================
--- pypy/branch/src-newobjectmodel/pypy/objspace/std/userobject.py	(original)
+++ pypy/branch/src-newobjectmodel/pypy/objspace/std/userobject.py	Fri Jun  4 10:29:11 2004
@@ -143,12 +143,7 @@
     def next_call(self, space, *args_w):
         "For .next()."
         # don't accept NotImplemented nor a real None, but catch StopIteration
-        try:
-            return self.do_call(space, args_w)
-        except OperationError, e:
-            if not e.match(space, space.w_StopIteration):
-                raise
-            raise NoValue
+        return self.do_call(space, args_w)
 
     def nonzero_call(self, space, *args_w):
         "For __nonzero__()."



More information about the Pypy-commit mailing list