diff options
author | Sylvain <sylvain.desodt+github@gmail.com> | 2017-06-10 04:51:48 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-06-10 04:51:48 (GMT) |
commit | 7445381c606faf20e253da42656db478a4349f8e (patch) | |
tree | 49ad79e5347454d1bbfeb1c2d06d3d09fd9b273f /Objects/clinic/tupleobject.c.h | |
parent | e5f6e86c48c7b2eb9e1d6a0e72867b4d8b4720f3 (diff) | |
download | cpython-7445381c606faf20e253da42656db478a4349f8e.zip cpython-7445381c606faf20e253da42656db478a4349f8e.tar.gz cpython-7445381c606faf20e253da42656db478a4349f8e.tar.bz2 |
bpo-30600: Fix error messages (condition order in Argument Clinic) (#2051)
The function '_PyArg_ParseStack()' and
'_PyArg_UnpackStack' were failing (with error
"XXX() takes Y argument (Z given)") before
the function '_PyArg_NoStackKeywords()' was called.
Thus, the latter did not raise its more meaningful
error : "XXX() takes no keyword arguments".
Diffstat (limited to 'Objects/clinic/tupleobject.c.h')
-rw-r--r-- | Objects/clinic/tupleobject.c.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/clinic/tupleobject.c.h b/Objects/clinic/tupleobject.c.h index 880b258..a6eedff 100644 --- a/Objects/clinic/tupleobject.c.h +++ b/Objects/clinic/tupleobject.c.h @@ -25,12 +25,12 @@ tuple_index(PyTupleObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kw 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_NoStackKeywords("index", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("index", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "O|O&O&:index", + &value, _PyEval_SliceIndexNotNone, &start, _PyEval_SliceIndexNotNone, &stop)) { goto exit; } return_value = tuple_index_impl(self, value, start, stop); @@ -99,4 +99,4 @@ tuple___getnewargs__(PyTupleObject *self, PyObject *Py_UNUSED(ignored)) { return tuple___getnewargs___impl(self); } -/*[clinic end generated code: output=145bcfff64e8c809 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=70b4de94a0002ec3 input=a9049054013a1b77]*/ |