diff options
author | Zachary Ware <zachary.ware@gmail.com> | 2015-04-13 23:22:35 (GMT) |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2015-04-13 23:22:35 (GMT) |
commit | 8ef887ce47421e0e3e9ec0c95735990bb0594ffe (patch) | |
tree | 3a547c2984fd7086cc1d7a7840734bf7ae94baff /Tools | |
parent | a6cc551502aac1fd011009abe40686f4647ba6b0 (diff) | |
download | cpython-8ef887ce47421e0e3e9ec0c95735990bb0594ffe.zip cpython-8ef887ce47421e0e3e9ec0c95735990bb0594ffe.tar.gz cpython-8ef887ce47421e0e3e9ec0c95735990bb0594ffe.tar.bz2 |
Issue #20586: Argument Clinic now ensures signatures on functions without docstrings.
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/clinic/clinic.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 9623ab4..99f5c3d 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -66,6 +66,8 @@ class Unknown: unknown = Unknown() +sig_end_marker = '--' + _text_accumulator_nt = collections.namedtuple("_text_accumulator", "text append output") @@ -559,8 +561,13 @@ class CLanguage(Language): add(quoted_for_c_string(line)) add('\\n"\n') - text.pop() - add('"') + if text[-2] == sig_end_marker: + # If we only have a signature, add the blank line that the + # __text_signature__ getter expects to be there. + add('"\\n"') + else: + text.pop() + add('"') return ''.join(text) def output_templates(self, f): @@ -4015,7 +4022,7 @@ class DSLParser: # add(f.return_converter.py_default) if not f.docstring_only: - add("\n--\n") + add("\n" + sig_end_marker + "\n") docstring_first_line = output() |