diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2022-06-27 13:33:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 13:33:34 +0300 |
commit | 33fc3b5e42f241ab81cc6d115711545b4f9e271e (patch) | |
tree | 968b2097985e09020379d09359ce8f9c5c085d9f /Lib/pydoc.py | |
parent | f5c85aa3eea1adf0c61089583e2251282a316ec1 (diff) | |
download | cpython-git-33fc3b5e42f241ab81cc6d115711545b4f9e271e.tar.gz |
gh-94318: Strip trailing spaces in pydoc text output (GH-94319)
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-x | Lib/pydoc.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index e96cacbe43..a4dc910c8a 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -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): |