Skip to content

Compatible with python 3.14#112

Open
likeelli wants to merge 2 commits intoTencentCloud:masterfrom
likeelli:compatible_with_python_3.14
Open

Compatible with python 3.14#112
likeelli wants to merge 2 commits intoTencentCloud:masterfrom
likeelli:compatible_with_python_3.14

Conversation

@likeelli
Copy link

No description provided.

Python 3.14's argparse._expand_help() performs '% params' string
formatting on every help string when rendering help output. If the
help text contains a bare '%' that is not a valid '%(name)s'
specifier (e.g. '100%', URL-encoded '%3A', special-char docs like
'% ^ & *'), a ValueError ('badly formed help string') is raised.

Fix: add _escape_help_string() in argument.py that replaces every
'%' with '%%' before the string is handed to argparse. This causes
argparse's HelpFormatter to render the original '%' characters
correctly, while eliminating the format error.

The two documentation properties that feed help= are updated:
- CustomArgument.documentation
- CLIArgument.documentation

Also reverts the misdirected patches from the previous commit
(try/except wrappers in argparser.py, utils.py, main.py, and the
new compatibility.py module) which did not address the root cause.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant