bpo-29935: Fixed error messages in the index() method of tuple, list and deque (#887)
when pass indices of wrong type.
diff --git a/Objects/clinic/listobject.c.h b/Objects/clinic/listobject.c.h
index eeb932a..43d5599 100644
--- a/Objects/clinic/listobject.c.h
+++ b/Objects/clinic/listobject.c.h
@@ -196,7 +196,7 @@
Py_ssize_t stop = PY_SSIZE_T_MAX;
if (!_PyArg_ParseStack(args, nargs, "O|O&O&:index",
- &value, _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &stop)) {
+ &value, _PyEval_SliceIndexNotNone, &start, _PyEval_SliceIndexNotNone, &stop)) {
goto exit;
}
@@ -297,4 +297,4 @@
{
return list___reversed___impl(self);
}
-/*[clinic end generated code: output=2a3b75efcf858ed5 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=71deae70ca0e6799 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/tupleobject.c.h b/Objects/clinic/tupleobject.c.h
index 12f0df1..880b258 100644
--- a/Objects/clinic/tupleobject.c.h
+++ b/Objects/clinic/tupleobject.c.h
@@ -26,7 +26,7 @@
Py_ssize_t stop = PY_SSIZE_T_MAX;
if (!_PyArg_ParseStack(args, nargs, "O|O&O&:index",
- &value, _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &stop)) {
+ &value, _PyEval_SliceIndexNotNone, &start, _PyEval_SliceIndexNotNone, &stop)) {
goto exit;
}
@@ -99,4 +99,4 @@
{
return tuple___getnewargs___impl(self);
}
-/*[clinic end generated code: output=561a3654411d2225 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=145bcfff64e8c809 input=a9049054013a1b77]*/
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 9c63983..55da0e3 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -534,8 +534,8 @@
tuple.index
value: object
- start: object(converter="_PyEval_SliceIndex", type="Py_ssize_t") = 0
- stop: object(converter="_PyEval_SliceIndex", type="Py_ssize_t", c_default="PY_SSIZE_T_MAX") = sys.maxsize
+ start: slice_index(accept={int}) = 0
+ stop: slice_index(accept={int}, c_default="PY_SSIZE_T_MAX") = sys.maxsize
/
Return first index of value.
@@ -546,7 +546,7 @@
static PyObject *
tuple_index_impl(PyTupleObject *self, PyObject *value, Py_ssize_t start,
Py_ssize_t stop)
-/*[clinic end generated code: output=07b6f9f3cb5c33eb input=28890d4bec234471]*/
+/*[clinic end generated code: output=07b6f9f3cb5c33eb input=fb39e9874a21fe3f]*/
{
Py_ssize_t i;