Author: Lukas Diekmann <[email protected]>
Branch: list-strategies
Changeset: r47434:f8f4c2997bac
Date: 2011-02-23 17:09 +0100
http://bitbucket.org/pypy/pypy/changeset/f8f4c2997bac/
Log: setslice may change strategy if necessary
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
@@ -289,6 +289,13 @@
def setslice(self, w_list, start, step, slicelength, sequence_w):
assert slicelength >= 0
items = self.cast_from_void_star(w_list.storage)
+
+ if not self.is_correct_type(W_ListObject(sequence_w)):
+ w_list.strategy = ObjectListStrategy()
+ w_list.strategy.init_from_list_w(w_list, items)
+ w_list.setslice(start, step, slicelength, sequence_w)
+ return
+
oldsize = len(items)
len2 = len(sequence_w)
if step == 1: # Support list resizing for non-extended slices
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit