diff options
| author | Sylvain <sylvain.desodt+github@gmail.com> | 2017-06-10 06:51:48 +0200 |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-06-10 07:51:48 +0300 |
| commit | 7445381c606faf20e253da42656db478a4349f8e (patch) | |
| tree | 49ad79e5347454d1bbfeb1c2d06d3d09fd9b273f /Modules/clinic/arraymodule.c.h | |
| parent | e5f6e86c48c7b2eb9e1d6a0e72867b4d8b4720f3 (diff) | |
| download | cpython-git-7445381c606faf20e253da42656db478a4349f8e.tar.gz | |
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 'Modules/clinic/arraymodule.c.h')
| -rw-r--r-- | Modules/clinic/arraymodule.c.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Modules/clinic/arraymodule.c.h b/Modules/clinic/arraymodule.c.h index 2a6767458e..6ffd4ff39f 100644 --- a/Modules/clinic/arraymodule.c.h +++ b/Modules/clinic/arraymodule.c.h @@ -76,12 +76,12 @@ array_array_pop(arrayobject *self, PyObject **args, Py_ssize_t nargs, PyObject * PyObject *return_value = NULL; Py_ssize_t i = -1; - if (!_PyArg_ParseStack(args, nargs, "|n:pop", - &i)) { + if (!_PyArg_NoStackKeywords("pop", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("pop", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "|n:pop", + &i)) { goto exit; } return_value = array_array_pop_impl(self, i); @@ -118,12 +118,12 @@ array_array_insert(arrayobject *self, PyObject **args, Py_ssize_t nargs, PyObjec Py_ssize_t i; PyObject *v; - if (!_PyArg_ParseStack(args, nargs, "nO:insert", - &i, &v)) { + if (!_PyArg_NoStackKeywords("insert", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("insert", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "nO:insert", + &i, &v)) { goto exit; } return_value = array_array_insert_impl(self, i, v); @@ -220,12 +220,12 @@ array_array_fromfile(arrayobject *self, PyObject **args, Py_ssize_t nargs, PyObj PyObject *f; Py_ssize_t n; - if (!_PyArg_ParseStack(args, nargs, "On:fromfile", - &f, &n)) { + if (!_PyArg_NoStackKeywords("fromfile", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("fromfile", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "On:fromfile", + &f, &n)) { goto exit; } return_value = array_array_fromfile_impl(self, f, n); @@ -472,12 +472,12 @@ array__array_reconstructor(PyObject *module, PyObject **args, Py_ssize_t nargs, enum machine_format_code mformat_code; PyObject *items; - if (!_PyArg_ParseStack(args, nargs, "OCiO:_array_reconstructor", - &arraytype, &typecode, &mformat_code, &items)) { + if (!_PyArg_NoStackKeywords("_array_reconstructor", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("_array_reconstructor", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "OCiO:_array_reconstructor", + &arraytype, &typecode, &mformat_code, &items)) { goto exit; } return_value = array__array_reconstructor_impl(module, arraytype, typecode, mformat_code, items); @@ -521,4 +521,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__, #define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \ {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__}, -/*[clinic end generated code: output=d186a7553c1f1a41 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=fb4a67e697d7c0b0 input=a9049054013a1b77]*/ |
