Author: Ronan Lamy <[email protected]>
Branch: py3k
Changeset: r83655:a26ea4a8b7fd
Date: 2016-04-13 18:27 +0100
http://bitbucket.org/pypy/pypy/changeset/a26ea4a8b7fd/
Log: Merged in marky1991/pypy_new/33_fix_itertools (pull request #425)
Py3k: Fix bug in itertools PR.
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
@@ -1117,7 +1117,7 @@
class W_Product(W_Root):
def __init__(self, space, args_w, w_repeat):
self.gears = [
- space.unpackiterable(arg_w) for arg_w in args_w
+ space.unpackiterable(arg_w)[:] for arg_w in args_w
] * space.int_w(w_repeat)
#
for gear in self.gears:
@@ -1508,6 +1508,7 @@
else:
self.started = True
return w_result
+
def descr_reduce(self, space):
if self.raised_stop_iteration:
pool_w = []
@@ -1609,14 +1610,14 @@
self.w_total = self.space.call_function(self.w_func, self.w_total,
w_value)
return self.w_total
- def descr_reduce(self):
+ def reduce_w(self):
space = self.space
w_total = space.w_None if self.w_total is None else self.w_total
w_func = space.w_None if self.w_func is None else self.w_func
return space.newtuple([space.gettypefor(W_Accumulate),
space.newtuple([self.w_iterable, w_func]),
w_total])
- def descr_setstate(self, space, w_state):
+ def setstate_w(self, space, w_state):
self.w_total = w_state if not space.is_w(w_state, space.w_None) else
None
def W_Accumulate__new__(space, w_subtype, w_iterable, w_func=None):
@@ -1628,8 +1629,8 @@
__new__ = interp2app(W_Accumulate__new__),
__iter__ = interp2app(W_Accumulate.iter_w),
__next__ = interp2app(W_Accumulate.next_w),
- __reduce__ = interp2app(W_Accumulate.descr_reduce),
- __setstate__ = interp2app(W_Accumulate.descr_setstate),
+ __reduce__ = interp2app(W_Accumulate.reduce_w),
+ __setstate__ = interp2app(W_Accumulate.setstate_w),
__doc__ = """\
"accumulate(iterable) --> accumulate object
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit