[pypy-commit] pypy sepcomp2: Add a failing test about passing exception between modules.

amauryfa noreply at buildbot.pypy.org
Tue Sep 4 23:57:03 CEST 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
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


More information about the pypy-commit mailing list