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 /Objects/clinic/bytearrayobject.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 'Objects/clinic/bytearrayobject.c.h')
-rw-r--r-- | Objects/clinic/bytearrayobject.c.h | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/Objects/clinic/bytearrayobject.c.h b/Objects/clinic/bytearrayobject.c.h index a181d9a..8363dbd 100644 --- a/Objects/clinic/bytearrayobject.c.h +++ b/Objects/clinic/bytearrayobject.c.h @@ -100,12 +100,12 @@ bytearray_maketrans(void *null, PyObject **args, Py_ssize_t nargs, PyObject *kwn Py_buffer frm = {NULL, NULL}; Py_buffer to = {NULL, NULL}; - if (!_PyArg_ParseStack(args, nargs, "y*y*:maketrans", - &frm, &to)) { + if (!_PyArg_NoStackKeywords("maketrans", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("maketrans", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "y*y*:maketrans", + &frm, &to)) { goto exit; } return_value = bytearray_maketrans_impl(&frm, &to); @@ -151,12 +151,12 @@ bytearray_replace(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, Py Py_buffer new = {NULL, NULL}; Py_ssize_t count = -1; - if (!_PyArg_ParseStack(args, nargs, "y*y*|n:replace", - &old, &new, &count)) { + if (!_PyArg_NoStackKeywords("replace", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("replace", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "y*y*|n:replace", + &old, &new, &count)) { goto exit; } return_value = bytearray_replace_impl(self, &old, &new, count); @@ -330,12 +330,12 @@ bytearray_insert(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyO Py_ssize_t index; int item; - if (!_PyArg_ParseStack(args, nargs, "nO&:insert", - &index, _getbytevalue, &item)) { + if (!_PyArg_NoStackKeywords("insert", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("insert", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "nO&:insert", + &index, _getbytevalue, &item)) { goto exit; } return_value = bytearray_insert_impl(self, index, item); @@ -410,12 +410,12 @@ bytearray_pop(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObje PyObject *return_value = NULL; Py_ssize_t index = -1; - if (!_PyArg_ParseStack(args, nargs, "|n:pop", - &index)) { + if (!_PyArg_NoStackKeywords("pop", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("pop", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "|n:pop", + &index)) { goto exit; } return_value = bytearray_pop_impl(self, index); @@ -474,13 +474,13 @@ bytearray_strip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyOb PyObject *return_value = NULL; PyObject *bytes = Py_None; - if (!_PyArg_UnpackStack(args, nargs, "strip", - 0, 1, - &bytes)) { + if (!_PyArg_NoStackKeywords("strip", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("strip", kwnames)) { + if (!_PyArg_UnpackStack(args, nargs, "strip", + 0, 1, + &bytes)) { goto exit; } return_value = bytearray_strip_impl(self, bytes); @@ -509,13 +509,13 @@ bytearray_lstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyO PyObject *return_value = NULL; PyObject *bytes = Py_None; - if (!_PyArg_UnpackStack(args, nargs, "lstrip", - 0, 1, - &bytes)) { + if (!_PyArg_NoStackKeywords("lstrip", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("lstrip", kwnames)) { + if (!_PyArg_UnpackStack(args, nargs, "lstrip", + 0, 1, + &bytes)) { goto exit; } return_value = bytearray_lstrip_impl(self, bytes); @@ -544,13 +544,13 @@ bytearray_rstrip(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyO PyObject *return_value = NULL; PyObject *bytes = Py_None; - if (!_PyArg_UnpackStack(args, nargs, "rstrip", - 0, 1, - &bytes)) { + if (!_PyArg_NoStackKeywords("rstrip", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("rstrip", kwnames)) { + if (!_PyArg_UnpackStack(args, nargs, "rstrip", + 0, 1, + &bytes)) { goto exit; } return_value = bytearray_rstrip_impl(self, bytes); @@ -712,12 +712,12 @@ bytearray_reduce_ex(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *return_value = NULL; int proto = 0; - if (!_PyArg_ParseStack(args, nargs, "|i:__reduce_ex__", - &proto)) { + if (!_PyArg_NoStackKeywords("__reduce_ex__", kwnames)) { goto exit; } - if (!_PyArg_NoStackKeywords("__reduce_ex__", kwnames)) { + if (!_PyArg_ParseStack(args, nargs, "|i:__reduce_ex__", + &proto)) { goto exit; } return_value = bytearray_reduce_ex_impl(self, proto); @@ -743,4 +743,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored)) { return bytearray_sizeof_impl(self); } -/*[clinic end generated code: output=f5c364927425fae8 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=f0079d8ee82614f7 input=a9049054013a1b77]*/ |