]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-133300: argparse: make `suggest_on_error` a keyword-only parameter (#133302)
authorHugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Fri, 2 May 2025 15:11:44 +0000 (18:11 +0300)
committerGitHub <noreply@github.com>
Fri, 2 May 2025 15:11:44 +0000 (18:11 +0300)
Doc/library/argparse.rst
Lib/argparse.py
Misc/NEWS.d/next/Library/2025-05-02-17-23-41.gh-issue-133300.oAh1P2.rst [new file with mode: 0644]

index 64e332a2afff30f27eb48fc1daaadd4661086cf6..feccc635ff71a45a54e986f572f5b15c5d39e10d 100644 (file)
@@ -74,7 +74,7 @@ ArgumentParser objects
                           prefix_chars='-', fromfile_prefix_chars=None, \
                           argument_default=None, conflict_handler='error', \
                           add_help=True, allow_abbrev=True, exit_on_error=True, \
-                          suggest_on_error=False, color=False)
+                          *, suggest_on_error=False, color=False)
 
    Create a new :class:`ArgumentParser` object. All parameters should be passed
    as keyword arguments. Each parameter has its own more detailed description
index 6e3e81405b3c0f3aab02b6ef2964c64ae0d27cc1..c0dcd0bbff063c3891234af7fec0019b8a8b8288 100644 (file)
@@ -1886,8 +1886,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
                  add_help=True,
                  allow_abbrev=True,
                  exit_on_error=True,
-                 suggest_on_error=False,
                  *,
+                 suggest_on_error=False,
                  color=False,
                  ):
         superinit = super(ArgumentParser, self).__init__
diff --git a/Misc/NEWS.d/next/Library/2025-05-02-17-23-41.gh-issue-133300.oAh1P2.rst b/Misc/NEWS.d/next/Library/2025-05-02-17-23-41.gh-issue-133300.oAh1P2.rst
new file mode 100644 (file)
index 0000000..a999552
--- /dev/null
@@ -0,0 +1,2 @@
+Make :class:`argparse.ArgumentParser`'s ``suggest_on_error`` a keyword-only
+parameter. Patch by Hugo van Kemenade.