mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
gh-94318: Strip trailing spaces in pydoc text output (GH-94319)
This commit is contained in:
parent
f5c85aa3ee
commit
33fc3b5e42
4 changed files with 78 additions and 78 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue