From: Alex Hochheiden Date: Tue, 21 Oct 2025 18:26:54 +0000 Subject: Bug 1993797 - Remove invalid `action="store_true"` from positional arguments in `dispatcher.py` r=firefox-build-system-reviewers,sergesanspaille In Python 3.14, positional arguments cannot have `action="store_true"`. It seems these were only used for help text anyway, and not parsed, so removing this fixes it for Python 3.14 without changing the behavior, while maintaining backwards compatibility with Python 3.9. Differential Revision: https://phabricator.services.mozilla.com/D269410 (cherry picked from commit dde4db6dea5c1504db58eee58b05b849600a0c5b) Origin: upstream, 146.0 --- python/mach/mach/dispatcher.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/python/mach/mach/dispatcher.py b/python/mach/mach/dispatcher.py index abc3b64..54b0f94 100644 --- a/python/mach/mach/dispatcher.py +++ b/python/mach/mach/dispatcher.py @@ -289,16 +289,14 @@ class CommandAction(argparse.Action): group = parser.add_argument_group(title, description) description = handler.description - group.add_argument(command, help=description, action="store_true") + group.add_argument(command, help=description) if disabled_commands and "disabled" in r.categories: title, description, _priority = r.categories["disabled"] group = parser.add_argument_group(title, description) if verbose: for c in disabled_commands: - group.add_argument( - c["command"], help=c["description"], action="store_true" - ) + group.add_argument(c["command"], help=c["description"]) parser.print_help() @@ -405,9 +403,7 @@ class CommandAction(argparse.Action): subhandlers, key=by_decl_order if handler.order == "declaration" else by_name, ): - group.add_argument( - subcommand, help=subhandler.description, action="store_true" - ) + group.add_argument(subcommand, help=subhandler.description) if handler.docstring: parser.description = format_docstring(handler.docstring)