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/stringio.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/stringio.c.h')
-rw-r--r-- | Modules/_io/clinic/stringio.c.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Modules/_io/clinic/stringio.c.h b/Modules/_io/clinic/stringio.c.h index 2710135..6dd4c5e 100644 --- a/Modules/_io/clinic/stringio.c.h +++ b/Modules/_io/clinic/stringio.c.h @@ -59,12 +59,12 @@ _io_StringIO_read(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *k 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_StringIO_read_impl(self, size); @@ -93,12 +93,12 @@ _io_StringIO_readline(stringio *self, PyObject **args, Py_ssize_t nargs, PyObjec 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_StringIO_readline_impl(self, size); @@ -129,12 +129,12 @@ _io_StringIO_truncate(stringio *self, PyObject **args, Py_ssize_t nargs, PyObjec 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_StringIO_truncate_impl(self, size); @@ -168,12 +168,12 @@ _io_StringIO_seek(stringio *self, PyObject **args, Py_ssize_t nargs, PyObject *k 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_StringIO_seek_impl(self, pos, whence); @@ -302,4 +302,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored)) { return _io_StringIO_seekable_impl(self); } -/*[clinic end generated code: output=03429d95ed7cd92f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=443f5dd99bbbd053 input=a9049054013a1b77]*/ |