Skip to content

Commit d45028d

Browse files
committed
Avoid whitespace-only lines in _fill_text()
It led to headaches in unittest.
1 parent 46e5e13 commit d45028d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/argparse.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,8 @@ def _split_lines(self, text, width):
766766

767767
def _fill_text(self, text, width, indent):
768768
lines = self._para_reformat(text, width - len(indent))
769-
return "\n".join(indent + line for line in lines)
769+
linearray = [indent + line if line else "" for line in lines]
770+
return "\n".join(linearray)
770771

771772
def _indents(self, line):
772773
"""Return line indent level and "sub_indent" for bullet list text."""

0 commit comments

Comments
 (0)