From 0cb4d6c6549d2299f7518f083bbe7d10314ecd66 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 22 Nov 2024 17:29:33 +0200 Subject: gh-86463: Fix default prog in subparsers if usage is used in the main parser (GH-125891) The usage parameter of argparse.ArgumentParser no longer affects the default value of the prog parameter in subparsers. Previously the full custom usage of the main parser was used as the prog prefix in subparsers. --- Lib/argparse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/argparse.py') diff --git a/Lib/argparse.py b/Lib/argparse.py index 5ecfdca1717..f5a7342c2fc 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1889,7 +1889,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): formatter = self._get_formatter() positionals = self._get_positional_actions() groups = self._mutually_exclusive_groups - formatter.add_usage(self.usage, positionals, groups, '') + formatter.add_usage(None, positionals, groups, '') kwargs['prog'] = formatter.format_help().strip() # create the parsers action and add it to the positionals list -- cgit v1.2.3