Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r68298:838ae931bcbd
Date: 2013-11-24 11:22 +0100
http://bitbucket.org/pypy/pypy/changeset/838ae931bcbd/

Log:    Add a passing test

diff --git a/rpython/translator/c/test/test_exception.py 
b/rpython/translator/c/test/test_exception.py
--- a/rpython/translator/c/test/test_exception.py
+++ b/rpython/translator/c/test/test_exception.py
@@ -156,3 +156,20 @@
     assert res == 42
     res = f1(0)
     assert res == 100
+
+def test_dict_keyerror_inside_try_finally():
+    class CtxMgr:
+        def __enter__(self):
+            return 42
+        def __exit__(self, *args):
+            pass
+    def fn(x):
+        d = {5: x}
+        with CtxMgr() as forty_two:
+            try:
+                return d[x]
+            except KeyError:
+                return forty_two
+    f1 = getcompiledopt(fn, [int])
+    res = f1(100)
+    assert res == 42
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to