[pypy-commit] pypy list-strategies: no more wrapping/unwrapping in AbstractStrategy.getslice
l.diekmann
noreply at buildbot.pypy.org
Fri Sep 23 13:14:53 CEST 2011
Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch: list-strategies
Changeset: r47524:4ad5f050b10e
Date: 2011-08-22 16:58 +0200
http://bitbucket.org/pypy/pypy/changeset/4ad5f050b10e/
Log: no more wrapping/unwrapping in AbstractStrategy.getslice
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
@@ -537,11 +537,15 @@
return W_ListObject.from_storage_and_strategy(self.space, storage, self)
else:
subitems_w = [None] * length
- # XXX wrap/unwrap
+ l = self.cast_from_void_star(w_list.lstorage)
for i in range(length):
- subitems_w[i] = w_list.getitem(start)
- start += step
- return W_ListObject(self.space, subitems_w)
+ try:
+ subitems_w[i] = l[start]
+ start += step
+ except IndexError:
+ raise
+ storage = self.cast_to_void_star(subitems_w)
+ return W_ListObject.from_storage_and_strategy(self.space, storage, self)
def append(self, w_list, w_item):
More information about the pypy-commit
mailing list