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 /Tools | |
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 'Tools')
-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 0845a8e..22cde14 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)) |