Skip to content

Commit 16ebf4b

Browse files
committed
Fix argparse error for BooleanArgument with % in documentation
Python 3.14+ argparse treats % characters in help strings as format specifiers. When service model documentation contains % (e.g., IAM's UpdateAccountPasswordPolicy RequireSymbols parameter), argparse raises: ValueError: unsupported format character '^' (0x5e) at index 129 This was already fixed for CLIArgument in PR aws#9790 but BooleanArgument was missed. This commit adds the same .replace('%', '%%') escaping to BooleanArgument.add_to_parser() and adds a test to verify all service operations with % in documentation work correctly. Fixes compatibility with Python 3.14+
1 parent ff104c9 commit 16ebf4b

File tree

2 files changed

+440
-308
lines changed

2 files changed

+440
-308
lines changed

awscli/arguments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ def add_to_arg_table(self, argument_table):
593593
def add_to_parser(self, parser):
594594
parser.add_argument(
595595
self.cli_name,
596-
help=self.documentation,
596+
help=self.documentation.replace('%', '%%'),
597597
action=self._action,
598598
default=self._default,
599599
dest=self._destination,

0 commit comments

Comments
 (0)