mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
when pass indices of wrong type. (cherry picked from commitd4edfc9abf
) (cherry picked from commitbf4bb2e430
)
This commit is contained in:
parent
c90ff1b78c
commit
8b8bde44f3
6 changed files with 31 additions and 11 deletions
|
@ -2154,8 +2154,8 @@ listindex(PyListObject *self, PyObject *args)
|
|||
PyObject *v;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O|O&O&:index", &v,
|
||||
_PyEval_SliceIndex, &start,
|
||||
_PyEval_SliceIndex, &stop))
|
||||
_PyEval_SliceIndexNotNone, &start,
|
||||
_PyEval_SliceIndexNotNone, &stop))
|
||||
return NULL;
|
||||
if (start < 0) {
|
||||
start += Py_SIZE(self);
|
||||
|
|
|
@ -515,8 +515,8 @@ tupleindex(PyTupleObject *self, PyObject *args)
|
|||
PyObject *v;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O|O&O&:index", &v,
|
||||
_PyEval_SliceIndex, &start,
|
||||
_PyEval_SliceIndex, &stop))
|
||||
_PyEval_SliceIndexNotNone, &start,
|
||||
_PyEval_SliceIndexNotNone, &stop))
|
||||
return NULL;
|
||||
if (start < 0) {
|
||||
start += Py_SIZE(self);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue