[issue6305] islice doesn't accept large stop values

Alok Singhal report at bugs.python.org
Tue Apr 22 01:11:25 CEST 2014


Alok Singhal added the comment:

This updated patch has support for starting in fast mode until the next count would result in overflow in Py_ssize_t.  The first patch started in slow mode as soon as any of 'start', 'stop', or 'step' was outside of the range.  With this patch, we start in fast mode if possible and then transition to slow mode when needed.

I also tested this patch for correctness for the following cases:

- starting in slow mode,
- transition from fast -> slow,
- pickle/unpickle

I did this by temporarily changing the code twice:

- to always use fast mode, and
- pretending that overflow occurs at value 5 instead of PY_SSIZE_T_MAX.

----------
Added file: http://bugs.python.org/file34996/islice_large_values-2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6305>
_______________________________________


More information about the Python-bugs-list mailing list