Author: Mark Young <[email protected]>
Branch: py3k
Changeset: r84172:230df15b48da
Date: 2016-05-03 10:36 -0400
http://bitbucket.org/pypy/pypy/changeset/230df15b48da/
Log: Hopefully merged correctly.
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
@@ -360,7 +360,7 @@
def arg_int_w(self, w_obj, minimum, errormsg):
space = self.space
try:
- result = space.int_w(space.int(w_obj)) # CPython allows floats
as parameters
+ result = space.int_w(w_obj)
except OperationError as e:
if e.async(space):
raise
@@ -581,7 +581,7 @@
space = self.space
try:
return space.next(w_iter)
- except OperationError as e:
+ except OperationError, e:
if not e.match(space, space.w_StopIteration):
raise
self.active -= 1
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
@@ -199,11 +199,8 @@
assert next(it) == x
raises(StopIteration, next, it)
- # CPython implementation allows floats
- it = itertools.islice([1, 2, 3, 4, 5], 0.0, 3.0, 2.0)
- for x in [1, 3]:
- assert next(it) == x
- raises(StopIteration, next, it)
+ # Do not allow floats
+ raises(ValueError, itertools.islice, [1, 2, 3, 4, 5], 0.0, 3.0, 2.0)
it = itertools.islice([1, 2, 3], 0, None)
for x in [1, 2, 3]:
@@ -217,8 +214,6 @@
assert list(itertools.islice(range(10), None,None)) == list(range(10))
assert list(itertools.islice(range(10), None,None,None)) ==
list(range(10))
- # check source iterator is not referenced from islice()
- # after the latter has been exhausted
import weakref
for args in [(1,), (None,), (0, None, 2)]:
it = (x for x in (1, 2, 3))
@@ -227,7 +222,7 @@
assert wr() is not None
list(it) # exhaust the iterator
import gc; gc.collect()
- assert wr() is None
+ assert wr() is not None
raises(StopIteration, next, it)
def test_islice_dropitems_exact(self):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit