Skip to content

Commit b032f3f

Browse files
[3.13] GH-54732: Tweak wording around empty lines in argument files (GH-150980) (#151167)
GH-54732: Tweak wording around empty lines in argument files (GH-150980) (cherry picked from commit 528550e) Co-authored-by: Savannah Ostrowski <savannah@python.org>
1 parent 5587646 commit b032f3f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Doc/library/argparse.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,8 @@ is considered equivalent to the expression ``['-f', 'foo', '-f', 'bar']``.
423423

424424
.. note::
425425

426-
Empty lines are treated as empty strings (``''``), which are allowed as values but
427-
not as arguments. Empty lines that are read as arguments will result in an
428-
"unrecognized arguments" error.
426+
Each line is treated as a single argument, so an empty line is read as an
427+
empty string (``''``).
429428

430429
:class:`ArgumentParser` uses :term:`filesystem encoding and error handler`
431430
to read the file containing arguments.
@@ -2092,6 +2091,9 @@ Customizing file parsing
20922091
def convert_arg_line_to_args(self, arg_line):
20932092
return arg_line.split()
20942093

2094+
Note that with this override an argument can no longer contain spaces, since
2095+
each space-separated word becomes a separate argument.
2096+
20952097

20962098
Exiting methods
20972099
^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)