[pypy-commit] pypy list-strategies: (l.diekmann, cfbolz around): some more calls to length; changed contains to use strategies
l.diekmann
noreply at buildbot.pypy.org
Fri Sep 23 13:11:10 CEST 2011
Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch: list-strategies
Changeset: r47412:a6dcfde63812
Date: 2011-01-20 14:57 +0100
http://bitbucket.org/pypy/pypy/changeset/a6dcfde63812/
Log: (l.diekmann, cfbolz around): some more calls to length; changed
contains to use strategies
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
@@ -156,21 +156,20 @@
return w_list.getslice(start, stop, 1, stop - start)
def setslice__List_ANY_ANY_ANY(space, w_list, w_start, w_stop, w_sequence):
- length = len(w_list.wrappeditems)
+ length = w_list.length()
start, stop = normalize_simple_slice(space, length, w_start, w_stop)
_setitem_slice_helper(space, w_list, start, 1, stop-start, w_sequence)
def delslice__List_ANY_ANY(space, w_list, w_start, w_stop):
- length = len(w_list.wrappeditems)
+ length = w_list.length()
start, stop = normalize_simple_slice(space, length, w_start, w_stop)
_delitem_slice_helper(space, w_list.wrappeditems, start, 1, stop-start)
def contains__List_ANY(space, w_list, w_obj):
# needs to be safe against eq_w() mutating the w_list behind our back
i = 0
- items_w = w_list.wrappeditems
- while i < len(items_w): # intentionally always calling len!
- if space.eq_w(items_w[i], w_obj):
+ while i < w_list.length(): # intentionally always calling len!
+ if space.eq_w(w_list.getitem(i), w_obj):
return space.w_True
i += 1
return space.w_False
More information about the pypy-commit
mailing list