diff options
author | Larry Hastings <larry@hastings.org> | 2014-01-22 11:05:49 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2014-01-22 11:05:49 (GMT) |
commit | 462582651c92dad3d0e50810075d53d4a04e2466 (patch) | |
tree | 8306867e6d7c27d4fda979bde24aef0869015abd /Tools/clinic | |
parent | 071baa63c4ea3a54a54d90b173dd777e08895976 (diff) | |
download | cpython-462582651c92dad3d0e50810075d53d4a04e2466.zip cpython-462582651c92dad3d0e50810075d53d4a04e2466.tar.gz cpython-462582651c92dad3d0e50810075d53d4a04e2466.tar.bz2 |
Two minor Argument Clinic bugfixes: use the name of the class in the
docstring for __new__ and __init__, and always use "goto exit" instead of
returning "NULL" for failure to parse (as _new__ and __init__ return ints).
Diffstat (limited to 'Tools/clinic')
-rwxr-xr-x | Tools/clinic/clinic.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 289ec26..8fc2e1e 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -913,7 +913,7 @@ __________________________________________________ s = """ case {count}: if (!PyArg_ParseTuple(args, "{format_units}:{name}", {parse_arguments})) - return NULL; + goto exit; {group_booleans} break; """[1:] @@ -924,7 +924,7 @@ __________________________________________________ add(" default:\n") s = ' PyErr_SetString(PyExc_TypeError, "{} requires {} to {} arguments");\n' add(s.format(f.full_name, count_min, count_max)) - add(' return NULL;\n') + add(' goto exit;\n') add("}}") template_dict['option_group_parsing'] = output() @@ -3401,7 +3401,11 @@ class DSLParser: ## docstring first line ## - add(f.name) + if f.kind in (METHOD_NEW, METHOD_INIT): + assert f.cls + add(f.cls.name) + else: + add(f.name) add('(') # populate "right_bracket_count" field for every parameter |