Skip to content

Commit 1cfa51b

Browse files
committed
gh-54732: Make argparse error caused by empty rows explicit
1 parent 03017a8 commit 1cfa51b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Doc/library/argparse.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,12 @@ were in the same place as the original file referencing argument on the command
440440
line. So in the example above, the expression ``['-f', 'foo', '@args.txt']``
441441
is considered equivalent to the expression ``['-f', 'foo', '-f', 'bar']``.
442442

443+
.. note::
444+
445+
Empty lines are treated as empty strings (''), which are allowed as values but not
446+
as arguments. Empty lines as arguments will result in an “unrecognized arguments”
447+
error.
448+
443449
:class:`ArgumentParser` uses :term:`filesystem encoding and error handler`
444450
to read the file containing arguments.
445451

0 commit comments

Comments
 (0)