]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-88753: Make BooleanOptionalAction's addition of default to help more similar to...
authorToshio Kuratomi <a.badger@gmail.com>
Tue, 3 May 2022 16:38:18 +0000 (09:38 -0700)
committerGitHub <noreply@github.com>
Tue, 3 May 2022 16:38:18 +0000 (18:38 +0200)
commit20490d5018cff4c604b37142323c531f8512b9aa
tree8b8b3717c4f24fdf4b6024f301538ddbda10c4f2
parent6c25bf07e86b6d8d5e50488835f70539f382d7e0
gh-88753: Make BooleanOptionalAction's addition of default to help more similar to other actions (#27808)

Help for other actions omit the default value if default is SUPPRESS or
already contains the special format string '%(default)'.  Add those
special cases to BooleanOptionalAction's help formatting too.

Fixes https://bugs.python.org/issue44587 so that default=SUPPRESS is not
emitted.

Fixes https://bugs.python.org/issue38956 as this code will detect
whether '%(default)s' has already been specified in the help string.

Signed-off-by: Micky Yun Chan (michiboo): <chanmickyyun@gmail.com>
Co-authored-by: Micky Yun Chan <michan@redhat.com>
Lib/argparse.py
Lib/test/test_argparse.py
Misc/NEWS.d/next/Library/2021-08-17-21-41-39.bpo-44587.57OKSz.rst [new file with mode: 0644]