-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Open
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
#141940 caused a regression where users cannot use format specifiers.
See this as an example
my_parser.add_argument(
"--foo",
type=int,
default=1234,
help=f"""0x%(default)x""",
)
The above works in 3.14.2, but not in 3.15 alpha3. I apologize if my code is doing something incorrect.
The error I get is
Traceback (most recent call last):
File "[...]/3.15.0a3/lib/python3.15/argparse.py", line 1793, in _check_help
formatter._expand_help(action)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "[...]/3.15.0a3/lib/python3.15/argparse.py", line 696, in _expand_help
return help_string % params
~~~~~~~~~~~~^~~~~~~~
TypeError: %x format: an integer is required, not str
Originally posted by @oyvindronningstad in #141940 (comment)
Linked PRs
oyvindronningstad and hamdanal
Metadata
Metadata
Assignees
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
No status