[pypy-commit] pypy value-profiling: what a stupid bug

cfbolz pypy.commits at gmail.com
Tue Jan 19 14:06:10 EST 2016


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: value-profiling
Changeset: r81866:e411e587da9b
Date: 2016-01-19 20:04 +0100
http://bitbucket.org/pypy/pypy/changeset/e411e587da9b/

Log:	what a stupid bug

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
@@ -82,7 +82,7 @@
             return True
         if not attr.ever_mutated:
             attr.ever_mutated = True
-        self.see_write(w_value)
+        attr.see_write(w_value)
         cell = obj._mapdict_read_storage(attr.storageindex)
         if jit.we_are_jitted() and attr.class_is_known():
             cls = attr.read_constant_cls()
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
@@ -558,6 +558,19 @@
     obj.setdictvalue(space, "a", a1)
     assert obj.getdictvalue(space, "a") is a1
 
+
+def test_bug_lost_write(monkeypatch):
+    none = Value(None)
+    true = Value(True)
+    false = Value(False)
+    cls = Class()
+    obj = cls.instantiate()
+    obj.setdictvalue(space, "tw", true)
+    obj.setdictvalue(space, "h", none)
+    obj.setdictvalue(space, "tw", false)
+    obj.setdictvalue(space, "tw", true)
+    assert obj.getdictvalue(space, "tw") is true
+
 # ___________________________________________________________
 # dict tests
 


More information about the pypy-commit mailing list