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/_io/clinic/bytesio.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/_io/clinic/bytesio.c.h')
-rw-r--r-- | Modules/_io/clinic/bytesio.c.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/Modules/_io/clinic/bytesio.c.h b/Modules/_io/clinic/bytesio.c.h index 559971c..4addaa8 100644 --- a/Modules/_io/clinic/bytesio.c.h +++ b/Modules/_io/clinic/bytesio.c.h @@ -169,12 +169,12 @@ _io_BytesIO_read(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwn PyObject *return_value = NULL; Py_ssize_t size = -1; - if (!_PyArg_ParseStack(args, nargs, "|O&:read", - _Py_convert_optional_to_ssize_t, &size)) { + if (!_PyArg_NoStackKeywords("read", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("read", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "|O&:read", + _Py_convert_optional_to_ssize_t, &size)) { goto exit; } return_value = _io_BytesIO_read_impl(self, size); @@ -204,12 +204,12 @@ _io_BytesIO_read1(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kw PyObject *return_value = NULL; Py_ssize_t size = -1; - if (!_PyArg_ParseStack(args, nargs, "|O&:read1", - _Py_convert_optional_to_ssize_t, &size)) { + if (!_PyArg_NoStackKeywords("read1", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("read1", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "|O&:read1", + _Py_convert_optional_to_ssize_t, &size)) { goto exit; } return_value = _io_BytesIO_read1_impl(self, size); @@ -240,12 +240,12 @@ _io_BytesIO_readline(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject PyObject *return_value = NULL; Py_ssize_t size = -1; - if (!_PyArg_ParseStack(args, nargs, "|O&:readline", - _Py_convert_optional_to_ssize_t, &size)) { + if (!_PyArg_NoStackKeywords("readline", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("readline", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "|O&:readline", + _Py_convert_optional_to_ssize_t, &size)) { goto exit; } return_value = _io_BytesIO_readline_impl(self, size); @@ -276,13 +276,13 @@ _io_BytesIO_readlines(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject PyObject *return_value = NULL; PyObject *arg = Py_None; - if (!_PyArg_UnpackStack(args, nargs, "readlines", - 0, 1, - &arg)) { + if (!_PyArg_NoStackKeywords("readlines", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("readlines", kwnames)) { + if (!_PyArg_UnpackStack(args, nargs, "readlines", + 0, 1, + &arg)) { goto exit; } return_value = _io_BytesIO_readlines_impl(self, arg); @@ -347,12 +347,12 @@ _io_BytesIO_truncate(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject PyObject *return_value = NULL; Py_ssize_t size = self->pos; - if (!_PyArg_ParseStack(args, nargs, "|O&:truncate", - _Py_convert_optional_to_ssize_t, &size)) { + if (!_PyArg_NoStackKeywords("truncate", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("truncate", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "|O&:truncate", + _Py_convert_optional_to_ssize_t, &size)) { goto exit; } return_value = _io_BytesIO_truncate_impl(self, size); @@ -386,12 +386,12 @@ _io_BytesIO_seek(bytesio *self, PyObject **args, Py_ssize_t nargs, PyObject *kwn Py_ssize_t pos; int whence = 0; - if (!_PyArg_ParseStack(args, nargs, "n|i:seek", - &pos, &whence)) { + if (!_PyArg_NoStackKeywords("seek", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("seek", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "n|i:seek", + &pos, &whence)) { goto exit; } return_value = _io_BytesIO_seek_impl(self, pos, whence); @@ -468,4 +468,4 @@ _io_BytesIO___init__(PyObject *self, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=733795434f838b71 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=9e63715414bffb2a input=a9049054013a1b77]*/ |