[issue31956] Add start and stop parameters to the array.index()

Anders Lorentsen report at bugs.python.org
Mon Nov 13 19:00:39 EST 2017


Anders Lorentsen <phaqui at gmail.com> added the comment:

Writing my tests, I originally looked at Lib/test/seq_tests.py. One test case uses indexes that are (+-)4*sys.maxsize. This does not fit in Py_ssize_t, and so these tests cause my array implementation to raise an overflow exception.

A solution is of course to have the function take general objects instead, and then truncate them down to a number that can fit in Py_ssize_t if it's too negative or positive).

But I concur. It seems more reasonable to stay consistent with the rest of the module, too.

I'll look over the test code to make sure I test for every given scenario (or as many as I can think of), and prepare a PR for this, then :)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31956>
_______________________________________


More information about the Python-bugs-list mailing list