| 1 |
From: Alex Hochheiden <[email protected]> |
| 2 |
Date: Tue, 21 Oct 2025 18:26:54 +0000 |
| 3 |
Subject: Bug 1993797 - Remove invalid `action="store_true"` from positional |
| 4 |
arguments in `dispatcher.py` |
| 5 |
r=firefox-build-system-reviewers,sergesanspaille |
| 6 |
|
| 7 |
In Python 3.14, positional arguments cannot have `action="store_true"`. It seems these were only used |
| 8 |
for help text anyway, and not parsed, so removing this fixes it for Python 3.14 without changing the |
| 9 |
behavior, while maintaining backwards compatibility with Python 3.9. |
| 10 |
|
| 11 |
Differential Revision: https://phabricator.services.mozilla.com/D269410 |
| 12 |
|
| 13 |
(cherry picked from commit dde4db6dea5c1504db58eee58b05b849600a0c5b) |
| 14 |
|
| 15 |
Origin: upstream, 146.0 |
| 16 |
--- |
| 17 |
python/mach/mach/dispatcher.py | 10 +++------- |
| 18 |
1 file changed, 3 insertions(+), 7 deletions(-) |
| 19 |
|
| 20 |
diff --git a/python/mach/mach/dispatcher.py b/python/mach/mach/dispatcher.py |
| 21 |
index abc3b64..54b0f94 100644 |
| 22 |
--- a/python/mach/mach/dispatcher.py |
| 23 |
+++ b/python/mach/mach/dispatcher.py |
| 24 |
@@ -289,16 +289,14 @@ class CommandAction(argparse.Action): |
| 25 |
group = parser.add_argument_group(title, description) |
| 26 |
|
| 27 |
description = handler.description |
| 28 |
- group.add_argument(command, help=description, action="store_true") |
| 29 |
+ group.add_argument(command, help=description) |
| 30 |
|
| 31 |
if disabled_commands and "disabled" in r.categories: |
| 32 |
title, description, _priority = r.categories["disabled"] |
| 33 |
group = parser.add_argument_group(title, description) |
| 34 |
if verbose: |
| 35 |
for c in disabled_commands: |
| 36 |
- group.add_argument( |
| 37 |
- c["command"], help=c["description"], action="store_true" |
| 38 |
- ) |
| 39 |
+ group.add_argument(c["command"], help=c["description"]) |
| 40 |
|
| 41 |
parser.print_help() |
| 42 |
|
| 43 |
@@ -405,9 +403,7 @@ class CommandAction(argparse.Action): |
| 44 |
subhandlers, |
| 45 |
key=by_decl_order if handler.order == "declaration" else by_name, |
| 46 |
): |
| 47 |
- group.add_argument( |
| 48 |
- subcommand, help=subhandler.description, action="store_true" |
| 49 |
- ) |
| 50 |
+ group.add_argument(subcommand, help=subhandler.description) |
| 51 |
|
| 52 |
if handler.docstring: |
| 53 |
parser.description = format_docstring(handler.docstring) |