Uh oh!
There was an error while loading. Please reload this page.
GH-142950: Process format specifiers before colourization in argparse help - #142960
Conversation
Thanks for working on this and fixing the bug I introduced 😭 (I was planning to fix it today but saw your PR). # parser.add_argument("--str", default="test", help="100%%")#Traceback (mostrecentcalllast):
File"/Users/aprengere/Dev/cpython/Lib/argparse.py", line1810, in_check_helpformatter._expand_help(action)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^File"/Users/aprengere/Dev/cpython/Lib/argparse.py", line712, in_expand_helpraiseValueError(f"invalid format specifier in: {help_string!r}")
ValueError: invalidformatspecifierin: '100%%'This is due to the final check: if'%'inresult:
raiseValueError(f"invalid format specifier in: {help_string!r}")Removing this check it makes |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
savannahostrowski
commented
Jan 4, 2026
Hey folks - thanks for the thoughtful and thorough feedback on this PR! Apologies for the delay in addressing it - I was out on vacation over the holidays! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.