bpo-35582: Argument Clinic: inline parsing code for positional parameters. (GH-11313)

This commit is contained in:
Serhiy Storchaka 2019-01-11 16:01:14 +02:00 committed by GitHub
parent 5485085b32
commit 4fa9591025
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
60 changed files with 6194 additions and 778 deletions

View file

@ -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]*/