gh-94318: Strip trailing spaces in pydoc text output (GH-94319)

This commit is contained in:
Serhiy Storchaka 2022-06-27 13:33:34 +03:00 committed by GitHub
parent f5c85aa3ee
commit 33fc3b5e42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 78 additions and 78 deletions

View file

@ -1171,8 +1171,7 @@ class TextDoc(Doc):
def indent(self, text, prefix=' '):
"""Indent text by prepending a given prefix to each line."""
if not text: return ''
lines = [prefix + line for line in text.split('\n')]
if lines: lines[-1] = lines[-1].rstrip()
lines = [(prefix + line).rstrip() for line in text.split('\n')]
return '\n'.join(lines)
def section(self, title, contents):