[pypy-svn] r17712 - pypy/dist/pypy/translator/llvm/test

ericvrp at codespeak.net ericvrp at codespeak.net
Wed Sep 21 12:17:49 CEST 2005


Author: ericvrp
Date: Wed Sep 21 12:17:48 2005
New Revision: 17712

Modified:
   pypy/dist/pypy/translator/llvm/test/test_exception.py
Log:
added test to detect not clearing of exception-occurred flag.
(mostly for what I currently call fast exceptionpolicy)


Modified: pypy/dist/pypy/translator/llvm/test/test_exception.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/test/test_exception.py	(original)
+++ pypy/dist/pypy/translator/llvm/test/test_exception.py	Wed Sep 21 12:17:48 2005
@@ -194,6 +194,27 @@
     for i in [-1, 0, 1, 2]:
         assert f(i) == i
 
+def test_two_exceptions():
+    def fn1():
+        raise Exception
+    def fn2():
+        return 10
+    def two_exceptions():
+        r = 50
+        try:
+            fn1()
+            r += 1
+        except:
+            r += 100
+        try:
+            r += fn2()
+        except:
+            r += 300
+        r += fn2()
+        return r
+    f = compile_function(two_exceptions, [])
+    assert f() == two_exceptions()
+            
 def test_raise_outside_testfn():
     def raiser(n):
         if n < 0:



More information about the Pypy-commit mailing list