diff options
author | Sylvain <sylvain.desodt+github@gmail.com> | 2017-06-10 06:51:48 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-06-10 07:51:48 +0300 |
commit | 7445381c606faf20e253da42656db478a4349f8e (patch) | |
tree | 49ad79e5347454d1bbfeb1c2d06d3d09fd9b273f /Tools/clinic/clinic.py | |
parent | bpo-25409: Clarify fnmatch and fnmatchcase documentation (GH-1535) (diff) | |
download | cpython-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 'Tools/clinic/clinic.py')
-rwxr-xr-x | Tools/clinic/clinic.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 0845a8e9b19..22cde144f37 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -828,13 +828,13 @@ class CLanguage(Language): parser_prototype = parser_prototype_fastcall parser_definition = parser_body(parser_prototype, normalize_snippet(""" - if (!_PyArg_UnpackStack(args, nargs, "{name}", - {unpack_min}, {unpack_max}, - {parse_arguments})) {{ + if ({self_type_check}!_PyArg_NoStackKeywords("{name}", kwnames)) {{ goto exit; }} - if ({self_type_check}!_PyArg_NoStackKeywords("{name}", kwnames)) {{ + if (!_PyArg_UnpackStack(args, nargs, "{name}", + {unpack_min}, {unpack_max}, + {parse_arguments})) {{ goto exit; }} """, indent=4)) @@ -859,12 +859,12 @@ class CLanguage(Language): parser_prototype = parser_prototype_fastcall parser_definition = parser_body(parser_prototype, normalize_snippet(""" - if (!_PyArg_ParseStack(args, nargs, "{format_units}:{name}", - {parse_arguments})) {{ + if ({self_type_check}!_PyArg_NoStackKeywords("{name}", kwnames)) {{ goto exit; }} - if ({self_type_check}!_PyArg_NoStackKeywords("{name}", kwnames)) {{ + if (!_PyArg_ParseStack(args, nargs, "{format_units}:{name}", + {parse_arguments})) {{ goto exit; }} """, indent=4)) |