]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] GH-54732: Tweak wording around empty lines in argument files (GH-150980) ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 9 Jun 2026 15:44:18 +0000 (17:44 +0200)
committerGitHub <noreply@github.com>
Tue, 9 Jun 2026 15:44:18 +0000 (15:44 +0000)
GH-54732: Tweak wording around empty lines in argument files (GH-150980)
(cherry picked from commit 528550e0e753d64714f65a02d567bdc1d63ae3f1)

Co-authored-by: Savannah Ostrowski <savannah@python.org>
Doc/library/argparse.rst

index fa5b92ed81b85a32ad7def8a86d3257e185017bd..32e5ab9fc23a923b0e8175869ac50e96dab2af1c 100644 (file)
@@ -423,9 +423,8 @@ is considered equivalent to the expression ``['-f', 'foo', '-f', 'bar']``.
 
 .. note::
 
-   Empty lines are treated as empty strings (``''``), which are allowed as values but
-   not as arguments. Empty lines that are read as arguments will result in an
-   "unrecognized arguments" error.
+   Each line is treated as a single argument, so an empty line is read as an
+   empty string (``''``).
 
 :class:`ArgumentParser` uses :term:`filesystem encoding and error handler`
 to read the file containing arguments.
@@ -2092,6 +2091,9 @@ Customizing file parsing
         def convert_arg_line_to_args(self, arg_line):
             return arg_line.split()
 
+   Note that with this override an argument can no longer contain spaces, since
+   each space-separated word becomes a separate argument.
+
 
 Exiting methods
 ^^^^^^^^^^^^^^^