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/listobject.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/listobject.c.h')
-rw-r--r-- | Objects/clinic/listobject.c.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Objects/clinic/listobject.c.h b/Objects/clinic/listobject.c.h index 43d5599..d5b9b1e 100644 --- a/Objects/clinic/listobject.c.h +++ b/Objects/clinic/listobject.c.h @@ -21,12 +21,12 @@ list_insert(PyListObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwn Py_ssize_t index; PyObject *object; - if (!_PyArg_ParseStack(args, nargs, "nO:insert", - &index, &object)) { + if (!_PyArg_NoStackKeywords("insert", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("insert", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "nO:insert", + &index, &object)) { goto exit; } return_value = list_insert_impl(self, index, object); @@ -109,12 +109,12 @@ list_pop(PyListObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwname PyObject *return_value = NULL; Py_ssize_t index = -1; - if (!_PyArg_ParseStack(args, nargs, "|n:pop", - &index)) { + if (!_PyArg_NoStackKeywords("pop", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("pop", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "|n:pop", + &index)) { goto exit; } return_value = list_pop_impl(self, index); @@ -195,12 +195,12 @@ list_index(PyListObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwna 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 = list_index_impl(self, value, start, stop); @@ -297,4 +297,4 @@ list___reversed__(PyListObject *self, PyObject *Py_UNUSED(ignored)) { return list___reversed___impl(self); } -/*[clinic end generated code: output=71deae70ca0e6799 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=63cbe6d6320e916f input=a9049054013a1b77]*/ |