Author: Lukas Diekmann <[email protected]>
Branch: list-strategies
Changeset: r47451:e31f975d8b0f
Date: 2011-03-02 14:49 +0100
http://bitbucket.org/pypy/pypy/changeset/e31f975d8b0f/
Log: Changed W_ListObject iterable to use getitem
diff --git a/pypy/objspace/std/iterobject.py b/pypy/objspace/std/iterobject.py
--- a/pypy/objspace/std/iterobject.py
+++ b/pypy/objspace/std/iterobject.py
@@ -30,9 +30,9 @@
"""Sequence iterator specialized for lists, accessing
directly their RPython-level list of wrapped objects.
"""
- def __init__(w_self, w_seq, wrappeditems):
+ def __init__(w_self, w_seq):
W_AbstractSeqIterObject.__init__(w_self, w_seq)
- w_self.listitems = wrappeditems
+ w_self.w_seq = w_seq
class W_FastTupleIterObject(W_AbstractSeqIterObject):
"""Sequence iterator specialized for tuples, accessing
@@ -102,13 +102,13 @@
return w_seqiter
def next__FastListIter(space, w_seqiter):
- if w_seqiter.listitems is None:
+ if w_seqiter.w_seq is None:
raise OperationError(space.w_StopIteration, space.w_None)
index = w_seqiter.index
try:
- w_item = w_seqiter.listitems[index]
+ w_item = w_seqiter.w_seq.getitem(index)
except IndexError:
- w_seqiter.listitems = None
+ w_seqiter.w_seq = None
w_seqiter.w_seq = None
raise OperationError(space.w_StopIteration, space.w_None)
w_seqiter.index = index + 1
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
@@ -604,8 +604,7 @@
def iter__List(space, w_list):
from pypy.objspace.std import iterobject
- import pdb; pdb.set_trace()
- return iterobject.W_FastListIterObject(w_list, w_list.getitems())
+ return iterobject.W_FastListIterObject(w_list)
def add__List_List(space, w_list1, w_list2):
return W_ListObject(space, w_list1.getitems() + w_list2.getitems())
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit