[pypy-svn] r67552 - in pypy/trunk/pypy/rlib: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Sep 7 14:17:44 CEST 2009


Author: cfbolz
Date: Mon Sep  7 14:17:43 2009
New Revision: 67552

Modified:
   pypy/trunk/pypy/rlib/rweakref.py
   pypy/trunk/pypy/rlib/test/test_rweakref.py
Log:
stupid stupid. really need to make a new annotations, otherwise the constness of
one can survive.


Modified: pypy/trunk/pypy/rlib/rweakref.py
==============================================================================
--- pypy/trunk/pypy/rlib/rweakref.py	(original)
+++ pypy/trunk/pypy/rlib/rweakref.py	Mon Sep  7 14:17:43 2009
@@ -59,7 +59,7 @@
     def union((s_wvd1, s_wvd2)):
         if s_wvd1.valueclassdef is not s_wvd2.valueclassdef:
             return SomeObject() # not the same class! complain...
-        return s_wvd1
+        return SomeWeakValueDict(s_wvd1.valueclassdef)
 
 class Entry(extregistry.ExtRegistryEntry):
     _about_ = RWeakValueDictionary

Modified: pypy/trunk/pypy/rlib/test/test_rweakref.py
==============================================================================
--- pypy/trunk/pypy/rlib/test/test_rweakref.py	(original)
+++ pypy/trunk/pypy/rlib/test/test_rweakref.py	Mon Sep  7 14:17:43 2009
@@ -88,8 +88,23 @@
     f()
     interpret(f, [])
 
-
 def test_rpython_merge_RWeakValueDictionary():
+    empty = RWeakValueDictionary(X)
+    def f(n):
+        x = X()
+        if n:
+            d = empty
+        else:
+            d = RWeakValueDictionary(X)
+            d.set("a", x)
+        return d.get("a") is x
+    assert f(0)
+    assert interpret(f, [0])
+    assert not f(1)
+    assert not interpret(f, [1])
+
+
+def test_rpython_merge_RWeakValueDictionary2():
     class A(object):
         def __init__(self):
             self.d = RWeakValueDictionary(A)



More information about the Pypy-commit mailing list