diff options
author | Zachary Ware <zachary.ware@gmail.com> | 2015-04-13 18:22:35 -0500 |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2015-04-13 18:22:35 -0500 |
commit | 605ad6a026d02b5101c2d746d31e17ad52f902b1 (patch) | |
tree | 991ce47abee5f5e6977e220eeb7d9568311f0d77 /Tools/clinic/clinic.py | |
parent | e43bbe2166fa92c5a574a4cbfe70423291816733 (diff) | |
download | cpython-605ad6a026d02b5101c2d746d31e17ad52f902b1.tar.gz |
Issue #20586: Argument Clinic now ensures signatures on functions without docstrings.
Diffstat (limited to 'Tools/clinic/clinic.py')
-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 9623ab4466..99f5c3d60a 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() |