[pypy-commit] pypy stm-gc: Test and fix.

arigo noreply at buildbot.pypy.org
Thu Feb 16 20:18:25 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r52562:b44e53969410
Date: 2012-02-16 18:47 +0100
http://bitbucket.org/pypy/pypy/changeset/b44e53969410/

Log:	Test and fix.

diff --git a/pypy/translator/stm/gcsource.py b/pypy/translator/stm/gcsource.py
--- a/pypy/translator/stm/gcsource.py
+++ b/pypy/translator/stm/gcsource.py
@@ -83,6 +83,8 @@
                 for v1, v2 in zip(link.args, link.target.inputargs):
                     if _is_gc(v2):
                         assert _is_gc(v1)
+                        if v1 is link.last_exc_value:
+                            v1 = None
                         resultlist.append((v1, v2))
     #
     for graph in translator.graphs:
diff --git a/pypy/translator/stm/test/test_gcsource.py b/pypy/translator/stm/test/test_gcsource.py
--- a/pypy/translator/stm/test/test_gcsource.py
+++ b/pypy/translator/stm/test/test_gcsource.py
@@ -115,3 +115,18 @@
     v_result = gsrc.translator.graphs[0].getreturnvar()
     s = gsrc[v_result]
     assert list(s) == [None]
+
+def test_exception():
+    class FooError(Exception):
+        pass
+    def f(n):
+        raise FooError
+    def main(n):
+        try:
+            f(n)
+        except FooError, e:
+            return e
+    gsrc = gcsource(main, [int])
+    v_result = gsrc.translator.graphs[0].getreturnvar()
+    s = gsrc[v_result]
+    assert list(s) == [None]


More information about the pypy-commit mailing list