https://github.com/python/cpython/commit/8d063f3d922850ee2199d0e63a93904e53f02ef1
commit: 8d063f3d922850ee2199d0e63a93904e53f02ef1
branch: 3.14
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: AA-Turner <9087854+aa-tur...@users.noreply.github.com>
date: 2025-07-19T14:28:52Z
summary:

[3.14] gh-54732: Make argparse error caused by empty rows in option files 
explicit (GH-136795) (#136818)

gh-54732: Make argparse error caused by empty rows in option files explicit 
(GH-136795)
(cherry picked from commit 8ffc3ef01e83ffe629c6107082677de4d23974d5)

Co-authored-by: jdunter <2...@mailbox.org>
Co-authored-by: Adam Turner <9087854+aa-tur...@users.noreply.github.com>

files:
M Doc/library/argparse.rst

diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index f189f6b8fa8953..a08f713ab56ba3 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -434,12 +434,18 @@ arguments they contain.  For example::
    >>> parser.parse_args(['-f', 'foo', '@args.txt'])
    Namespace(f='bar')
 
-Arguments read from a file must by default be one per line (but see also
+Arguments read from a file must be one per line by default (but see also
 :meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they
 were in the same place as the original file referencing argument on the command
 line.  So in the example above, the expression ``['-f', 'foo', '@args.txt']``
 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.
+
 :class:`ArgumentParser` uses :term:`filesystem encoding and error handler`
 to read the file containing arguments.
 

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to