summaryrefslogtreecommitdiffstats
path: root/Objects/clinic/dictobject.c.h
diff options
context:
space:
mode:
authorSylvain <sylvain.desodt+github@gmail.com>2017-06-10 04:51:48 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-06-10 04:51:48 (GMT)
commit7445381c606faf20e253da42656db478a4349f8e (patch)
tree49ad79e5347454d1bbfeb1c2d06d3d09fd9b273f /Objects/clinic/dictobject.c.h
parente5f6e86c48c7b2eb9e1d6a0e72867b4d8b4720f3 (diff)
downloadcpython-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/dictobject.c.h')
-rw-r--r--Objects/clinic/dictobject.c.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/Objects/clinic/dictobject.c.h b/Objects/clinic/dictobject.c.h
index fb1e797..2e11cd2 100644
--- a/Objects/clinic/dictobject.c.h
+++ b/Objects/clinic/dictobject.c.h
@@ -21,13 +21,13 @@ dict_fromkeys(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *k
PyObject *iterable;
PyObject *value = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "fromkeys",
- 1, 2,
- &iterable, &value)) {
+ if (!_PyArg_NoStackKeywords("fromkeys", kwnames)) {
goto exit;
}
- if (!_PyArg_NoStackKeywords("fromkeys", kwnames)) {
+ if (!_PyArg_UnpackStack(args, nargs, "fromkeys",
+ 1, 2,
+ &iterable, &value)) {
goto exit;
}
return_value = dict_fromkeys_impl(type, iterable, value);
@@ -64,13 +64,13 @@ dict_get(PyDictObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwname
PyObject *key;
PyObject *default_value = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "get",
- 1, 2,
- &key, &default_value)) {
+ if (!_PyArg_NoStackKeywords("get", kwnames)) {
goto exit;
}
- if (!_PyArg_NoStackKeywords("get", kwnames)) {
+ if (!_PyArg_UnpackStack(args, nargs, "get",
+ 1, 2,
+ &key, &default_value)) {
goto exit;
}
return_value = dict_get_impl(self, key, default_value);
@@ -101,13 +101,13 @@ dict_setdefault(PyDictObject *self, PyObject **args, Py_ssize_t nargs, PyObject
PyObject *key;
PyObject *default_value = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "setdefault",
- 1, 2,
- &key, &default_value)) {
+ if (!_PyArg_NoStackKeywords("setdefault", kwnames)) {
goto exit;
}
- if (!_PyArg_NoStackKeywords("setdefault", kwnames)) {
+ if (!_PyArg_UnpackStack(args, nargs, "setdefault",
+ 1, 2,
+ &key, &default_value)) {
goto exit;
}
return_value = dict_setdefault_impl(self, key, default_value);
@@ -115,4 +115,4 @@ dict_setdefault(PyDictObject *self, PyObject **args, Py_ssize_t nargs, PyObject
exit:
return return_value;
}
-/*[clinic end generated code: output=4d57df133cf66e53 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=49e03ab4360f5be0 input=a9049054013a1b77]*/