[pypy-svn] r53099 - in pypy/branch/jit-hotpath/pypy/rpython: . test

arigo at codespeak.net arigo at codespeak.net
Sat Mar 29 17:59:31 CET 2008


Author: arigo
Date: Sat Mar 29 17:59:29 2008
New Revision: 53099

Modified:
   pypy/branch/jit-hotpath/pypy/rpython/rtyper.py
   pypy/branch/jit-hotpath/pypy/rpython/test/test_rlist.py
Log:
Quick workaround for an rtyper crash in valid code.


Modified: pypy/branch/jit-hotpath/pypy/rpython/rtyper.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/rpython/rtyper.py	(original)
+++ pypy/branch/jit-hotpath/pypy/rpython/rtyper.py	Sat Mar 29 17:59:29 2008
@@ -797,11 +797,13 @@
         if self.llops.implicit_exceptions_checked is not None:
             # sanity check: complain if an has_implicit_exception() check is
             # missing in the rtyper.
-            for link in self.exceptionlinks:
-                if link.exitcase not in self.llops.implicit_exceptions_checked:
-                    raise TyperError("the graph catches %s, but the rtyper "
-                                     "did not explicitely handle it" % (
-                        link.exitcase.__name__,))
+            # XXX can't do this, see test_rlist.py:test_catch_other_exc
+            pass
+            #for link in self.exceptionlinks:
+            #    if link.exitcase not in self.llops.implicit_exceptions_checked:
+            #        raise TyperError("the graph catches %s, but the rtyper "
+            #                         "did not explicitely handle it" % (
+            #            link.exitcase.__name__,))
         self.llops.llop_raising_exceptions = len(self.llops)
 
     def exception_cannot_occur(self):

Modified: pypy/branch/jit-hotpath/pypy/rpython/test/test_rlist.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/rpython/test/test_rlist.py	(original)
+++ pypy/branch/jit-hotpath/pypy/rpython/test/test_rlist.py	Sat Mar 29 17:59:29 2008
@@ -1323,6 +1323,16 @@
         res = self.interpret(f, [])
         assert res == 42
 
+    def test_catch_other_exc(self):
+        def f(x):
+            l1 = [x]
+            try:
+                return l1.pop(0)
+            except ValueError:
+                return 42
+        res = self.interpret(f, [5])
+        assert res == 5
+
 
 class TestLLtype(BaseTestRlist, LLRtypeMixin):
     rlist = ll_rlist



More information about the Pypy-commit mailing list