[pypy-svn] r77161 - in pypy/branch/better-map-instances/pypy/objspace/std: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Fri Sep 17 20:56:15 CEST 2010


Author: cfbolz
Date: Fri Sep 17 20:56:14 2010
New Revision: 77161

Modified:
   pypy/branch/better-map-instances/pypy/objspace/std/mapdict.py
   pypy/branch/better-map-instances/pypy/objspace/std/test/test_mapdict.py
Log:
a bug, but not the one we are looking for


Modified: pypy/branch/better-map-instances/pypy/objspace/std/mapdict.py
==============================================================================
--- pypy/branch/better-map-instances/pypy/objspace/std/mapdict.py	(original)
+++ pypy/branch/better-map-instances/pypy/objspace/std/mapdict.py	Fri Sep 17 20:56:14 2010
@@ -273,7 +273,7 @@
 
 
 class BaseMapdictObject: # slightly evil to make it inherit from W_Root
-    _mixin_ = True # XXX hack hack hack
+    _mixin_ = True
 
     def _init_empty(self, map):
         raise NotImplementedError("abstract base class")
@@ -318,7 +318,8 @@
         w_dict = check_new_dictionary(space, w_dict)
         w_olddict = self.getdict()
         assert isinstance(w_dict, W_DictMultiObject)
-        w_olddict._as_rdict()
+        if w_olddict.r_dict_content is None:
+            w_olddict._as_rdict()
         flag = self._get_mapdict_map().write(self, ("dict", SPECIAL), w_dict)
         assert flag
 

Modified: pypy/branch/better-map-instances/pypy/objspace/std/test/test_mapdict.py
==============================================================================
--- pypy/branch/better-map-instances/pypy/objspace/std/test/test_mapdict.py	(original)
+++ pypy/branch/better-map-instances/pypy/objspace/std/test/test_mapdict.py	Fri Sep 17 20:56:14 2010
@@ -408,7 +408,6 @@
         assert obj2.getdictvalue(space, "b") is w6
         assert obj2.map is abmap
 
-
 # ___________________________________________________________
 # integration tests
 
@@ -508,6 +507,15 @@
         assert a.__dict__ is d
         assert isinstance(a, B)
 
+    def test_dict_devolved_bug(self):
+        class A(object):
+            pass
+        a = A()
+        a.x = 1
+        d = a.__dict__
+        d[1] = 3
+        a.__dict__ = {}
+
     def test_change_class_slots(self):
         skip("not supported by pypy yet")
         class A(object):



More information about the Pypy-commit mailing list