[pypy-svn] r32010 - pypy/dist/pypy/jit/hintannotator/test

pedronis at codespeak.net pedronis at codespeak.net
Tue Sep 5 15:31:11 CEST 2006


Author: pedronis
Date: Tue Sep  5 15:31:09 2006
New Revision: 32010

Modified:
   pypy/dist/pypy/jit/hintannotator/test/test_annotator.py
Log:
(arre, pedronis)

adding some tests about exceptions, skipped for now. Some pass, but what we want to achieve
is exception transform the graphs before hint annotating them.



Modified: pypy/dist/pypy/jit/hintannotator/test/test_annotator.py
==============================================================================
--- pypy/dist/pypy/jit/hintannotator/test/test_annotator.py	(original)
+++ pypy/dist/pypy/jit/hintannotator/test/test_annotator.py	Tue Sep  5 15:31:09 2006
@@ -470,3 +470,45 @@
     py.test.skip("in-progress: I think we expect a HintError here, do we?")
     py.test.raises(HintError, hannotate,
                    ll_getitem_switch, [annmodel.SomePtr(lltype.Ptr(S))])
+
+
+def test_raise_exc():
+    py.test.skip("work in-progress")
+    class E(Exception):
+        pass
+    def f1():
+        raise E
+    hannotate(f1, [], policy=P_OOPSPEC_NOVIRTUAL)
+
+    def f2():
+        e = E()
+        e.a = 3
+        raise e
+    hannotate(f2, [], policy=P_OOPSPEC_NOVIRTUAL)    
+    
+
+def test_raise_and_catch_exc():
+    py.test.skip("work in-progress")    
+    class E(Exception):
+        pass
+    def f(flag):
+        if flag:
+            raise E
+
+    def g(flag):
+        try:
+            f(flag)
+        except E:
+            return -1
+        return 0
+            
+    hannotate(g, [bool], policy=P_OOPSPEC_NOVIRTUAL)
+
+    def f(flag):
+        if flag:
+            e = E()
+            e.a = 3
+            raise e
+        
+    hannotate(g, [bool], policy=P_OOPSPEC_NOVIRTUAL)    
+    



More information about the Pypy-commit mailing list