mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Use _PyEval_SliceIndex to handle list.index() calls with
huge start and stop arguments. Add tests.
This commit is contained in:
parent
8e9b80fd56
commit
e8049befdf
2 changed files with 12 additions and 1 deletions
|
@ -1832,7 +1832,9 @@ listindex(PyListObject *self, PyObject *args)
|
|||
int i, start=0, stop=self->ob_size;
|
||||
PyObject *v;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O|ii:index", &v, &start, &stop))
|
||||
if (!PyArg_ParseTuple(args, "O|O&O&:index", &v,
|
||||
_PyEval_SliceIndex, &start,
|
||||
_PyEval_SliceIndex, &stop))
|
||||
return NULL;
|
||||
if (start < 0) {
|
||||
start += self->ob_size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue