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 /Modules/clinic/cmathmodule.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 'Modules/clinic/cmathmodule.c.h')
-rw-r--r-- | Modules/clinic/cmathmodule.c.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Modules/clinic/cmathmodule.c.h b/Modules/clinic/cmathmodule.c.h index b7a3727..09bd5df 100644 --- a/Modules/clinic/cmathmodule.c.h +++ b/Modules/clinic/cmathmodule.c.h @@ -653,12 +653,12 @@ cmath_log(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames Py_complex x; PyObject *y_obj = NULL; - if (!_PyArg_ParseStack(args, nargs, "D|O:log", - &x, &y_obj)) { + if (!_PyArg_NoStackKeywords("log", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("log", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "D|O:log", + &x, &y_obj)) { goto exit; } return_value = cmath_log_impl(module, x, y_obj); @@ -742,12 +742,12 @@ cmath_rect(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwname double r; double phi; - if (!_PyArg_ParseStack(args, nargs, "dd:rect", - &r, &phi)) { + if (!_PyArg_NoStackKeywords("rect", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("rect", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "dd:rect", + &r, &phi)) { goto exit; } return_value = cmath_rect_impl(module, r, phi); @@ -890,4 +890,4 @@ cmath_isclose(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwn exit: return return_value; } -/*[clinic end generated code: output=93eff5d4c242ee57 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=11a0b5bb8a652de6 input=a9049054013a1b77]*/ |