Author: Amaury Forgeot d'Arc <[email protected]>
Branch: sepcomp2
Changeset: r57137:60366c1af468
Date: 2012-04-03 00:20 +0200
http://bitbucket.org/pypy/pypy/changeset/60366c1af468/

Log:    Add a failing test about passing exception between modules.
        ExceptionTransform should be shared.

diff --git a/pypy/translator/c/test/test_export.py 
b/pypy/translator/c/test/test_export.py
--- a/pypy/translator/c/test/test_export.py
+++ b/pypy/translator/c/test/test_export.py
@@ -161,3 +161,21 @@
             return s.x
         mod = self.compile_module("second", g=g)
         assert mod.g() == 36.2
+
+    def test_exception(self):
+        @export(int)
+        def f(n):
+            if n == 0:
+                raise KeyError
+            return n
+        firstmodule = self.compile_module("first", f=f)
+
+        @export(int)
+        def g(n):
+            try:
+                return firstmodule.f(n)
+            except KeyError:
+                return 42
+        mod = self.compile_module("second", g=g)
+        assert mod.g(1) == 1
+        assert mod.g(0) == 42
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to