mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-35582: Argument Clinic: inline parsing code for positional parameters. (GH-11313)
This commit is contained in:
parent
5485085b32
commit
4fa9591025
60 changed files with 6194 additions and 778 deletions
19
Objects/clinic/tupleobject.c.h
generated
19
Objects/clinic/tupleobject.c.h
generated
|
@ -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]*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue