[pypy-svn] r25953 - pypy/dist/pypy/rpython/test

cfbolz at codespeak.net cfbolz at codespeak.net
Tue Apr 18 16:49:46 CEST 2006


Author: cfbolz
Date: Tue Apr 18 16:49:46 2006
New Revision: 25953

Modified:
   pypy/dist/pypy/rpython/test/test_objectmodel.py
Log:
test that shows the exception problem with r_dicts


Modified: pypy/dist/pypy/rpython/test/test_objectmodel.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_objectmodel.py	(original)
+++ pypy/dist/pypy/rpython/test/test_objectmodel.py	Tue Apr 18 16:49:46 2006
@@ -147,6 +147,22 @@
     res = interpret(fn, [2])
     assert res == 2
 
+def test_rtype_r_dict_exceptions():
+    def raising_hash(obj):
+        if id(obj) % 2 == 0:
+            raise TypeError
+        return 1
+    def eq(obj1, obj2):
+        return obj1 is obj2
+    def f():
+        d1 = r_dict(eq, raising_hash)
+        try:
+            x = d1["blabla"]
+        except Exception:
+            return 1
+        return x
+    res = interpret(f, [])
+
 def test_rtype_keepalive():
     from pypy.rpython import objectmodel
     def f():



More information about the Pypy-commit mailing list