https://github.com/python/cpython/commit/e6c518d2ebc6080710c8a1688d648bede28dad8d
commit: e6c518d2ebc6080710c8a1688d648bede28dad8d
branch: main
author: Hugo van Kemenade <1324225+hug...@users.noreply.github.com>
committer: hugovk <1324225+hug...@users.noreply.github.com>
date: 2025-05-02T18:11:44+03:00
summary:

gh-133300: argparse: make `suggest_on_error` a keyword-only parameter (#133302)

files:
A Misc/NEWS.d/next/Library/2025-05-02-17-23-41.gh-issue-133300.oAh1P2.rst
M Doc/library/argparse.rst
M Lib/argparse.py

diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index 64e332a2afff30..feccc635ff71a4 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -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
diff --git a/Lib/argparse.py b/Lib/argparse.py
index 6e3e81405b3c0f..c0dcd0bbff063c 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -1886,8 +1886,8 @@ def __init__(self,
                  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
index 00000000000000..a99955243e540c
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-05-02-17-23-41.gh-issue-133300.oAh1P2.rst
@@ -0,0 +1,2 @@
+Make :class:`argparse.ArgumentParser`'s ``suggest_on_error`` a keyword-only
+parameter. Patch by Hugo van Kemenade.

_______________________________________________
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