Author: Lukas Diekmann <[email protected]>
Branch: type-specialized-instances
Changeset: r49604:118048845a8d
Date: 2011-11-21 11:41 +0100
http://bitbucket.org/pypy/pypy/changeset/118048845a8d/
Log: reverted last fix, found a new (and better) one
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
@@ -100,8 +100,7 @@
def _findmap(self, selector):
while isinstance(self, AbstractStoredAttribute):
- # XXX is this the right fix?
- if selector == self.selector[:2]:
+ if selector == self.selector:
return self
self = self.back
return None
@@ -133,7 +132,7 @@
cache = self.cache_attrs = {}
attr = cache.get(key, None)
if attr is None:
- attr = attrclass(key, self)
+ attr = attrclass((name, index), self)
cache[key] = attr
return attr
@@ -278,12 +277,11 @@
self._size_estimate = self.length() * NUM_DIGITS_POW2
def _copy_attr(self, obj, new_obj):
- #XXX this the right fix?
- w_value = self.read(obj, self.selector[:2])
+ w_value = self.read(obj, self.selector)
new_obj._get_mapdict_map().add_attr(new_obj, self.selector, w_value)
def delete(self, obj, selector):
- if selector == self.selector[:2]:
+ if selector == self.selector:
# ok, attribute is deleted
return self.back.copy(obj)
new_obj = self.back.delete(obj, selector)
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
@@ -34,8 +34,8 @@
def test_plain_attribute():
w_cls = "class"
- aa = IntAttribute(("b", DICT, IntAttribute),
- IntAttribute(("a", DICT, IntAttribute),
+ aa = IntAttribute(("b", DICT),
+ IntAttribute(("a", DICT),
Terminator(space, w_cls)))
assert aa.space is space
assert aa.terminator.w_cls is w_cls
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit