[pypy-commit] pypy list-strategies: Removed wrappeditems form EmptyListStrategy.append and fixed related problems
l.diekmann
noreply at buildbot.pypy.org
Fri Sep 23 13:11:43 CEST 2011
Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch: list-strategies
Changeset: r47440:bac867bdab47
Date: 2011-02-25 14:35 +0100
http://bitbucket.org/pypy/pypy/changeset/bac867bdab47/
Log: Removed wrappeditems form EmptyListStrategy.append and fixed related
problems
diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -61,11 +61,11 @@
def __repr__(w_self):
""" representation for debugging purposes """
- return "%s(%s)" % (w_self.__class__.__name__, w_self.wrappeditems)
+ return "%s(%s)" % (w_self.__class__.__name__, w_self.getitems())
def unwrap(w_list, space):
# for tests only!
- items = [space.unwrap(w_item) for w_item in w_list.wrappeditems]
+ items = [space.unwrap(w_item) for w_item in w_list.getitems()]
return list(items)
def append(w_list, w_item):
@@ -190,8 +190,7 @@
else:
w_list.strategy = ObjectListStrategy()
- w_list.wrappeditems.append(w_item)
- w_list.strategy.init_from_list_w(w_list, w_list.wrappeditems)
+ w_list.strategy.init_from_list_w(w_list, [w_item])
def inplace_mul(self, w_list, times):
return
@@ -720,9 +719,7 @@
# needs to be safe against eq_w() mutating the w_list behind our back
i = 0
while i < w_list.length():
- #XXX: items will be wrapped. not necessary when liststrategies differ
if space.eq_w(w_list.getitem(i), w_any):
- #XXX: change of w_list.storage shouldn't be possible from the outside
if i < w_list.length(): # if this is wrong the list was changed
w_list.deleteitem(i)
return space.w_None
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -360,8 +360,8 @@
def unpackiterable(self, w_obj, expected_length=-1):
if isinstance(w_obj, W_TupleObject):
t = w_obj.wrappeditems[:]
- elif isinstance(w_obj, W_ListObject):
- t = w_obj.wrappeditems[:]
+ elif isinstance(w_obj, W_ListObject): # XXX enable fast path again
+ t = w_obj.getitems()
else:
return ObjSpace.unpackiterable(self, w_obj, expected_length)
if expected_length != -1 and len(t) != expected_length:
@@ -375,7 +375,7 @@
if isinstance(w_obj, W_TupleObject):
t = w_obj.wrappeditems
elif isinstance(w_obj, W_ListObject):
- t = w_obj.wrappeditems[:]
+ t = w_obj.getitems()
else:
if unroll:
return make_sure_not_resized(ObjSpace.unpackiterable_unroll(
@@ -392,7 +392,7 @@
def listview(self, w_obj, expected_length=-1):
if isinstance(w_obj, W_ListObject):
- t = w_obj.wrappeditems
+ t = w_obj.getitems()
elif isinstance(w_obj, W_TupleObject):
t = w_obj.wrappeditems[:]
else:
More information about the pypy-commit
mailing list