[pypy-svn] r69582 - in pypy/trunk/pypy/objspace/flow: . test

arigo at codespeak.net arigo at codespeak.net
Tue Nov 24 15:37:40 CET 2009


Author: arigo
Date: Tue Nov 24 15:37:39 2009
New Revision: 69582

Modified:
   pypy/trunk/pypy/objspace/flow/flowcontext.py
   pypy/trunk/pypy/objspace/flow/test/test_objspace.py
Log:
A test and fix in the flow object space.  This is a situation
in which we want to get an error, but the error was swallowed.


Modified: pypy/trunk/pypy/objspace/flow/flowcontext.py
==============================================================================
--- pypy/trunk/pypy/objspace/flow/flowcontext.py	(original)
+++ pypy/trunk/pypy/objspace/flow/flowcontext.py	Tue Nov 24 15:37:39 2009
@@ -399,3 +399,10 @@
         return ArgumentsForTranslation(self.space, self.peekvalues(nargs))
     def argument_factory(self, *args):
         return ArgumentsForTranslation(self.space, *args)
+
+    def handle_operation_error(self, ec, operr, *args, **kwds):
+        # see test_propagate_attribute_error for why this is here
+        if isinstance(operr, OperationThatShouldNotBePropagatedError):
+            raise operr
+        return pyframe.PyFrame.handle_operation_error(self, ec, operr,
+                                                      *args, **kwds)

Modified: pypy/trunk/pypy/objspace/flow/test/test_objspace.py
==============================================================================
--- pypy/trunk/pypy/objspace/flow/test/test_objspace.py	(original)
+++ pypy/trunk/pypy/objspace/flow/test/test_objspace.py	Tue Nov 24 15:37:39 2009
@@ -883,6 +883,15 @@
             return s[-3:]
         check(f3, 'llo')
 
+    def test_propagate_attribute_error(self):
+        def f(x):
+            try:
+                "".invalid
+            finally:
+                if x and 0:
+                    raise TypeError()
+        py.test.raises(Exception, self.codetest, f)
+
 
 class TestFlowObjSpaceDelay(Base):
     def setup_class(cls):



More information about the Pypy-commit mailing list