Skip to content

Commit 9d92876

Browse files
[3.14] GH-54732: Tweak wording around empty lines in argument files (GH-150980) (#151166)
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 cd1828f commit 9d92876

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
@@ -442,9 +442,8 @@ is considered equivalent to the expression ``['-f', 'foo', '-f', 'bar']``.
442442

443443
.. note::
444444

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

449448
:class:`ArgumentParser` uses :term:`filesystem encoding and error handler`
450449
to read the file containing arguments.
@@ -2203,6 +2202,9 @@ Customizing file parsing
22032202
def convert_arg_line_to_args(self, arg_line):
22042203
return arg_line.split()
22052204

2205+
Note that with this override an argument can no longer contain spaces, since
2206+
each space-separated word becomes a separate argument.
2207+
22062208

22072209
Exiting methods
22082210
^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)