New issue 2223: itertools.islice incompatibility with CPython
https://bitbucket.org/pypy/pypy/issues/2223/itertoolsislice-incompatibility-with

Jonas Pfannschmidt:

itertools.islice accepts floats as parameters in CPython but not in pypy.

CPython (Python 2.7):


```
#!python

>>> import itertools
>>> itertools.islice([1,2,3,4,5,6,7,8,9], 1.0, 6.0, 2.0)
<itertools.islice object at 0x7f14cd0d1e10>
```


pypy:


```
#!python

>>>> import itertools
>>>> itertools.islice([1,2,3,4,5,6,7,8,9], 1.0, 6.0, 2.0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Indicies for islice() must be None or non-negative integers
```


Please note that the behaviour in CPython for Python 3 is again different:


```
#!python

>>> import itertools
>>> itertools.islice([1,2,3,4,5,6,7,8,9], 1.0, 6.0, 2.0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Stop argument for islice() must be None or an integer: 0 <= x <= 
sys.maxsize.

```





_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to