aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain <sylvain.desodt+github@gmail.com>2017-06-10 06:51:48 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2017-06-10 07:51:48 +0300
commit7445381c606faf20e253da42656db478a4349f8e (patch)
tree49ad79e5347454d1bbfeb1c2d06d3d09fd9b273f /Modules/cjkcodecs
parentbpo-25409: Clarify fnmatch and fnmatchcase documentation (GH-1535) (diff)
downloadcpython-7445381c606faf20e253da42656db478a4349f8e.tar.gz
cpython-7445381c606faf20e253da42656db478a4349f8e.tar.bz2
cpython-7445381c606faf20e253da42656db478a4349f8e.zip
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/cjkcodecs')
-rw-r--r--Modules/cjkcodecs/clinic/multibytecodec.c.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/Modules/cjkcodecs/clinic/multibytecodec.c.h b/Modules/cjkcodecs/clinic/multibytecodec.c.h
index 4be06bbd668..28ee17a67f0 100644
--- a/Modules/cjkcodecs/clinic/multibytecodec.c.h
+++ b/Modules/cjkcodecs/clinic/multibytecodec.c.h
@@ -204,13 +204,13 @@ _multibytecodec_MultibyteStreamReader_read(MultibyteStreamReaderObject *self, Py
PyObject *return_value = NULL;
PyObject *sizeobj = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "read",
- 0, 1,
- &sizeobj)) {
+ if (!_PyArg_NoStackKeywords("read", kwnames)) {
goto exit;
}
- if (!_PyArg_NoStackKeywords("read", kwnames)) {
+ if (!_PyArg_UnpackStack(args, nargs, "read",
+ 0, 1,
+ &sizeobj)) {
goto exit;
}
return_value = _multibytecodec_MultibyteStreamReader_read_impl(self, sizeobj);
@@ -237,13 +237,13 @@ _multibytecodec_MultibyteStreamReader_readline(MultibyteStreamReaderObject *self
PyObject *return_value = NULL;
PyObject *sizeobj = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "readline",
- 0, 1,
- &sizeobj)) {
+ if (!_PyArg_NoStackKeywords("readline", kwnames)) {
goto exit;
}
- if (!_PyArg_NoStackKeywords("readline", kwnames)) {
+ if (!_PyArg_UnpackStack(args, nargs, "readline",
+ 0, 1,
+ &sizeobj)) {
goto exit;
}
return_value = _multibytecodec_MultibyteStreamReader_readline_impl(self, sizeobj);
@@ -270,13 +270,13 @@ _multibytecodec_MultibyteStreamReader_readlines(MultibyteStreamReaderObject *sel
PyObject *return_value = NULL;
PyObject *sizehintobj = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "readlines",
- 0, 1,
- &sizehintobj)) {
+ if (!_PyArg_NoStackKeywords("readlines", kwnames)) {
goto exit;
}
- if (!_PyArg_NoStackKeywords("readlines", kwnames)) {
+ if (!_PyArg_UnpackStack(args, nargs, "readlines",
+ 0, 1,
+ &sizehintobj)) {
goto exit;
}
return_value = _multibytecodec_MultibyteStreamReader_readlines_impl(self, sizehintobj);
@@ -342,4 +342,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
-/*[clinic end generated code: output=26710ffd4b3c7d7e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=12192026a9d55d48 input=a9049054013a1b77]*/