-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
GH-142950: Process format specifiers before colourization in argparse help #142960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 (most recent call last):
File "/Users/aprengere/Dev/cpython/Lib/argparse.py", line 1810, in _check_help
formatter._expand_help(action)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "/Users/aprengere/Dev/cpython/Lib/argparse.py", line 712, in _expand_help
raise ValueError(f"invalid format specifier in: {help_string!r}")
ValueError: invalid format specifier in: '100%%'This is due to the final check: if '%' in result:
raise ValueError(f"invalid format specifier in: {help_string!r}")Removing this check it makes |
|
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.