[pypy-svn] r35339 - in pypy/branch/jit-real-world/pypy: annotation rpython rpython/test

arigo at codespeak.net arigo at codespeak.net
Tue Dec 5 21:53:58 CET 2006


Author: arigo
Date: Tue Dec  5 21:53:56 2006
New Revision: 35339

Modified:
   pypy/branch/jit-real-world/pypy/annotation/annrpython.py
   pypy/branch/jit-real-world/pypy/rpython/robject.py
   pypy/branch/jit-real-world/pypy/rpython/test/test_exception.py
Log:
svn merge -r35324:35338 http://codespeak.net/svn/pypy/dist/pypy/rpython
svn merge -r35324:35338 http://codespeak.net/svn/pypy/dist/pypy/annotation


Modified: pypy/branch/jit-real-world/pypy/annotation/annrpython.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/annotation/annrpython.py	(original)
+++ pypy/branch/jit-real-world/pypy/annotation/annrpython.py	Tue Dec  5 21:53:56 2006
@@ -614,7 +614,6 @@
                         candidates = [c for c in candidates if c not in covered]
 
         for link in exits:
-            self.links_followed[link] = True
             import types
             in_except_block = False
 
@@ -695,7 +694,12 @@
             if in_except_block:
                 last_exception_object.is_type_of = last_exc_value_vars
 
+            if annmodel.s_ImpossibleValue in cells:
+                continue    # ignore links that try to pass impossible values
+
+            self.links_followed[link] = True
             self.addpendingblock(graph, link.target, cells)
+
         if block in self.notify:
             # reflow from certain positions when this block is done
             for callback in self.notify[block]:

Modified: pypy/branch/jit-real-world/pypy/rpython/robject.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/rpython/robject.py	(original)
+++ pypy/branch/jit-real-world/pypy/rpython/robject.py	Tue Dec  5 21:53:56 2006
@@ -9,10 +9,10 @@
 
 class __extend__(annmodel.SomeObject):
     def rtyper_makerepr(self, rtyper):
-        if self.is_constant():
-            return constpyobj_repr
         if self.knowntype is type:
             return rclass.get_type_repr(rtyper)
+        elif self.is_constant():
+            return constpyobj_repr
         else:
             return pyobj_repr
     def rtyper_makekey(self):

Modified: pypy/branch/jit-real-world/pypy/rpython/test/test_exception.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/rpython/test/test_exception.py	(original)
+++ pypy/branch/jit-real-world/pypy/rpython/test/test_exception.py	Tue Dec  5 21:53:56 2006
@@ -1,6 +1,8 @@
+import py
 from pypy.translator.translator import TranslationContext
 from pypy.rpython.lltypesystem.lltype import *
 from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
+from pypy.rpython.llinterp import LLException
 
 class MyException(Exception):
     pass
@@ -80,6 +82,38 @@
         res = self.interpret(f, [7])
         assert res is None
 
+    def test_raise_and_catch_other(self):
+        class BytecodeCorruption(Exception):
+            pass
+        class OperationError(Exception):
+            def __init__(self, a):
+                self.a = a
+        def f(next_instr):
+            if next_instr < 7:
+                raise OperationError(next_instr)
+            try:
+                raise BytecodeCorruption()
+            except OperationError, operr:
+                next_instr -= operr.a
+        py.test.raises(LLException, self.interpret, f, [10])
+
+    def test_raise_prebuilt_and_catch_other(self):
+        class BytecodeCorruption(Exception):
+            pass
+        class OperationError(Exception):
+            def __init__(self, a):
+                self.a = a
+        bcerr = BytecodeCorruption()
+        def f(next_instr):
+            if next_instr < 7:
+                raise OperationError(next_instr)
+            try:
+                raise bcerr
+            except OperationError, operr:
+                next_instr -= operr.a
+        py.test.raises(LLException, self.interpret, f, [10])
+
+
 class TestLLtype(BaseTestException, LLRtypeMixin):
     pass
 


More information about the pypy-svn mailing list