diff options
Diffstat (limited to 'Objects/clinic/tupleobject.c.h')
-rw-r--r-- | Objects/clinic/tupleobject.c.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Objects/clinic/tupleobject.c.h b/Objects/clinic/tupleobject.c.h index 67d9f34..0096f0c 100644 --- a/Objects/clinic/tupleobject.c.h +++ b/Objects/clinic/tupleobject.c.h @@ -25,10 +25,23 @@ tuple_index(PyTupleObject *self, PyObject *const *args, Py_ssize_t nargs) Py_ssize_t start = 0; Py_ssize_t stop = PY_SSIZE_T_MAX; - if (!_PyArg_ParseStack(args, nargs, "O|O&O&:index", - &value, _PyEval_SliceIndexNotNone, &start, _PyEval_SliceIndexNotNone, &stop)) { + if (!_PyArg_CheckPositional("index", nargs, 1, 3)) { goto exit; } + value = args[0]; + if (nargs < 2) { + goto skip_optional; + } + if (!_PyEval_SliceIndexNotNone(args[1], &start)) { + goto exit; + } + if (nargs < 3) { + goto skip_optional; + } + if (!_PyEval_SliceIndexNotNone(args[2], &stop)) { + goto exit; + } +skip_optional: return_value = tuple_index_impl(self, value, start, stop); exit: @@ -95,4 +108,4 @@ tuple___getnewargs__(PyTupleObject *self, PyObject *Py_UNUSED(ignored)) { return tuple___getnewargs___impl(self); } -/*[clinic end generated code: output=0a6ebd2d16b09c5d input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5312868473a41cfe input=a9049054013a1b77]*/ |