Author: Ronan Lamy <[email protected]>
Branch:
Changeset: r93066:e2f076c1fae4
Date: 2017-11-17 03:09 +0000
http://bitbucket.org/pypy/pypy/changeset/e2f076c1fae4/
Log: Convert ListItem.read_locations from dict to set
diff --git a/rpython/annotator/dictdef.py b/rpython/annotator/dictdef.py
--- a/rpython/annotator/dictdef.py
+++ b/rpython/annotator/dictdef.py
@@ -89,11 +89,11 @@
self.force_non_null = force_non_null
def read_key(self, position_key):
- self.dictkey.read_locations[position_key] = True
+ self.dictkey.read_locations.add(position_key)
return self.dictkey.s_value
def read_value(self, position_key):
- self.dictvalue.read_locations[position_key] = True
+ self.dictvalue.read_locations.add(position_key)
return self.dictvalue.s_value
def same_as(self, other):
diff --git a/rpython/annotator/listdef.py b/rpython/annotator/listdef.py
--- a/rpython/annotator/listdef.py
+++ b/rpython/annotator/listdef.py
@@ -30,7 +30,7 @@
self.s_value = s_value
self.bookkeeper = bookkeeper
self.itemof = {} # set of all ListDefs using this ListItem
- self.read_locations = {}
+ self.read_locations = set()
if bookkeeper is None:
self.dont_change_any_more = True
@@ -95,7 +95,7 @@
self.notify_update()
if s_new_value != s_other_value:
other.notify_update()
- self.read_locations.update(other.read_locations)
+ self.read_locations |= other.read_locations
def patch(self):
for listdef in self.itemof:
@@ -130,7 +130,7 @@
self.listitem.itemof[self] = True
def read_item(self, position_key):
- self.listitem.read_locations[position_key] = True
+ self.listitem.read_locations.add(position_key)
return self.listitem.s_value
def same_as(self, other):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit