summaryrefslogtreecommitdiffstats
path: root/Python/clinic/import.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 /Python/clinic/import.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 'Python/clinic/import.c.h')
-rw-r--r--Python/clinic/import.c.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h
index 0165b7c..5f4bad2 100644
--- a/Python/clinic/import.c.h
+++ b/Python/clinic/import.c.h
@@ -88,12 +88,12 @@ _imp__fix_co_filename(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObj
PyCodeObject *code;
PyObject *path;
- if (!_PyArg_ParseStack(args, nargs, "O!U:_fix_co_filename",
- &PyCode_Type, &code, &path)) {
+ if (!_PyArg_NoStackKeywords("_fix_co_filename", kwnames)) {
goto exit;
}
- if (!_PyArg_NoStackKeywords("_fix_co_filename", kwnames)) {
+ if (!_PyArg_ParseStack(args, nargs, "O!U:_fix_co_filename",
+ &PyCode_Type, &code, &path)) {
goto exit;
}
return_value = _imp__fix_co_filename_impl(module, code, path);
@@ -285,13 +285,13 @@ _imp_create_dynamic(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObjec
PyObject *spec;
PyObject *file = NULL;
- if (!_PyArg_UnpackStack(args, nargs, "create_dynamic",
- 1, 2,
- &spec, &file)) {
+ if (!_PyArg_NoStackKeywords("create_dynamic", kwnames)) {
goto exit;
}
- if (!_PyArg_NoStackKeywords("create_dynamic", kwnames)) {
+ if (!_PyArg_UnpackStack(args, nargs, "create_dynamic",
+ 1, 2,
+ &spec, &file)) {
goto exit;
}
return_value = _imp_create_dynamic_impl(module, spec, file);
@@ -369,4 +369,4 @@ exit:
#ifndef _IMP_EXEC_DYNAMIC_METHODDEF
#define _IMP_EXEC_DYNAMIC_METHODDEF
#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
-/*[clinic end generated code: output=c1d0e65d04114958 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b970357dbbe25ee4 input=a9049054013a1b77]*/