From c2f844c8d5a4c48b72d11972269e96f92713e402 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 2 May 2025 17:24:11 +0300 Subject: [PATCH] Make suggest_on_error a keyword-only parameter --- Doc/library/argparse.rst | 2 +- Lib/argparse.py | 2 +- .../next/Library/2025-05-02-17-23-41.gh-issue-133300.oAh1P2.rst | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2025-05-02-17-23-41.gh-issue-133300.oAh1P2.rst 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.