[pypy-commit] pypy speedup-unpackiterable: resolve armin's comments
fijal
noreply at buildbot.pypy.org
Tue Aug 21 20:41:14 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: speedup-unpackiterable
Changeset: r56779:3a2f001e11fc
Date: 2012-08-21 20:40 +0200
http://bitbucket.org/pypy/pypy/changeset/3a2f001e11fc/
Log: resolve armin's comments
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -22,7 +22,7 @@
unpackiterable_driver = jit.JitDriver(name = 'unpackiterable',
greens = ['tp'],
- reds = ['items', 'w_item', 'w_iterator'])
+ reds = ['items', 'w_iterator'])
class W_Root(object):
"""This is the abstract root class of all wrapped objects that live
@@ -875,11 +875,9 @@
items = [] # it might have lied
#
tp = self.type(w_iterator)
- w_item = None
while True:
unpackiterable_driver.jit_merge_point(tp=tp,
w_iterator=w_iterator,
- w_item=w_item, <-- why?
items=items)
try:
w_item = self.next(w_iterator)
diff --git a/pypy/module/itertools/interp_itertools.py b/pypy/module/itertools/interp_itertools.py
--- a/pypy/module/itertools/interp_itertools.py
+++ b/pypy/module/itertools/interp_itertools.py
@@ -112,11 +112,6 @@
s = 'repeat(%s)' % (objrepr,)
return self.space.wrap(s)
- def len(self, space):
- if self.count == -1 or not self.counting:
- raise OperationError(space.w_TypeError, space.wrap('len() of unsized object'))
- return space.wrap(self.count)
-
def W_Repeat___new__(space, w_subtype, w_object, w_times=None):
r = space.allocate_instance(W_Repeat, w_subtype)
r.__init__(space, w_object, w_times)
@@ -129,7 +124,6 @@
__iter__ = interp2app(W_Repeat.iter_w),
next = interp2app(W_Repeat.next_w),
__repr__ = interp2app(W_Repeat.repr_w),
- __len__ = interp2app(W_Repeat.len),
__doc__ = """Make an iterator that returns object over and over again.
Runs indefinitely unless the times argument is specified. Used
as argument to imap() for invariant parameters to the called
diff --git a/pypy/module/itertools/test/test_itertools.py b/pypy/module/itertools/test/test_itertools.py
--- a/pypy/module/itertools/test/test_itertools.py
+++ b/pypy/module/itertools/test/test_itertools.py
@@ -93,7 +93,6 @@
r = itertools.repeat('a', 15)
r.next()
- assert len(r) == 14 <-- no, python 2.7 does not have len(r)
raises(TypeError, "len(itertools.repeat('xkcd'))")
def test_takewhile(self):
More information about the pypy-commit
mailing list