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/fcntlmodule.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/fcntlmodule.c.h')
-rw-r--r-- | Modules/clinic/fcntlmodule.c.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Modules/clinic/fcntlmodule.c.h b/Modules/clinic/fcntlmodule.c.h index ed8d96a..a9815ea 100644 --- a/Modules/clinic/fcntlmodule.c.h +++ b/Modules/clinic/fcntlmodule.c.h @@ -32,12 +32,12 @@ fcntl_fcntl(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam int code; PyObject *arg = NULL; - if (!_PyArg_ParseStack(args, nargs, "O&i|O:fcntl", - conv_descriptor, &fd, &code, &arg)) { + if (!_PyArg_NoStackKeywords("fcntl", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("fcntl", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "O&i|O:fcntl", + conv_descriptor, &fd, &code, &arg)) { goto exit; } return_value = fcntl_fcntl_impl(module, fd, code, arg); @@ -95,12 +95,12 @@ fcntl_ioctl(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam PyObject *ob_arg = NULL; int mutate_arg = 1; - if (!_PyArg_ParseStack(args, nargs, "O&I|Op:ioctl", - conv_descriptor, &fd, &code, &ob_arg, &mutate_arg)) { + if (!_PyArg_NoStackKeywords("ioctl", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("ioctl", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "O&I|Op:ioctl", + conv_descriptor, &fd, &code, &ob_arg, &mutate_arg)) { goto exit; } return_value = fcntl_ioctl_impl(module, fd, code, ob_arg, mutate_arg); @@ -131,12 +131,12 @@ fcntl_flock(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam int fd; int code; - if (!_PyArg_ParseStack(args, nargs, "O&i:flock", - conv_descriptor, &fd, &code)) { + if (!_PyArg_NoStackKeywords("flock", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("flock", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "O&i:flock", + conv_descriptor, &fd, &code)) { goto exit; } return_value = fcntl_flock_impl(module, fd, code); @@ -189,12 +189,12 @@ fcntl_lockf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam PyObject *startobj = NULL; int whence = 0; - if (!_PyArg_ParseStack(args, nargs, "O&i|OOi:lockf", - conv_descriptor, &fd, &code, &lenobj, &startobj, &whence)) { + if (!_PyArg_NoStackKeywords("lockf", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("lockf", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "O&i|OOi:lockf", + conv_descriptor, &fd, &code, &lenobj, &startobj, &whence)) { goto exit; } return_value = fcntl_lockf_impl(module, fd, code, lenobj, startobj, whence); @@ -202,4 +202,4 @@ fcntl_lockf(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnam exit: return return_value; } -/*[clinic end generated code: output=b67e9579722e6d4f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=f189ac833d1448af input=a9049054013a1b77]*/ |