Author: Maciej Fijalkowski <fij...@gmail.com> Branch: Changeset: r69035:74b0b82fd9e2 Date: 2014-01-31 13:45 +0100 http://bitbucket.org/pypy/pypy/changeset/74b0b82fd9e2/
Log: (fijal, arigo, cfbolz) Fix (hopefully) the case where deleting and reinstantiating the attribute does not mark it as mutated diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py --- a/pypy/objspace/std/mapdict.py +++ b/pypy/objspace/std/mapdict.py @@ -57,7 +57,7 @@ return True def delete(self, obj, selector): - return None + pass def find_map_attr(self, selector): if jit.we_are_jitted(): @@ -291,6 +291,7 @@ def delete(self, obj, selector): if selector == self.selector: # ok, attribute is deleted + self.ever_mutated = True return self.back.copy(obj) new_obj = self.back.delete(obj, selector) if new_obj is not None: diff --git a/pypy/objspace/std/test/test_mapdict.py b/pypy/objspace/std/test/test_mapdict.py --- a/pypy/objspace/std/test/test_mapdict.py +++ b/pypy/objspace/std/test/test_mapdict.py @@ -144,7 +144,17 @@ assert obj2.map.back.ever_mutated == True assert obj2.map is obj.map - +def test_attr_immutability_delete(monkeypatch): + cls = Class() + obj = cls.instantiate() + obj.setdictvalue(space, "a", 10) + map1 = obj.map + import pdb + pdb.set_trace() + obj.deldictvalue(space, "a") + obj.setdictvalue(space, "a", 20) + assert obj.map.ever_mutated == True + assert obj.map is map1 def test_delete(): for i, dattr in enumerate(["a", "b", "c"]): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit