Skip to content
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

[3.10] bpo-38956: don't print BooleanOptionalAction's default twice (GH-27672) #27787

Merged
merged 1 commit into from Aug 17, 2021

Conversation

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Aug 16, 2021

Co-authored-by: Micky Yun Chan michan@redhat.com
(cherry picked from commit 1512bc2)

Co-authored-by: Maximilian Hils git@maximilianhils.com

https://bugs.python.org/issue38956

…H-27672)

Co-authored-by: Micky Yun Chan <michan@redhat.com>
(cherry picked from commit 1512bc2)

Co-authored-by: Maximilian Hils <git@maximilianhils.com>
@miss-islington
Copy link
Contributor Author

@miss-islington miss-islington commented Aug 16, 2021

@mhils and @ambv: Status check is done, and it's a success .

@miss-islington
Copy link
Contributor Author

@miss-islington miss-islington commented Aug 16, 2021

@mhils and @ambv: Status check is done, and it's a success .

1 similar comment
@miss-islington
Copy link
Contributor Author

@miss-islington miss-islington commented Aug 16, 2021

@mhils and @ambv: Status check is done, and it's a success .

Copy link
Contributor

@ambv ambv left a comment

@pablogsal, this is a trivial fix for duplicated default values displayed in help for boolean options (added in 3.9.0). I intend to release that in 3.9.7 on August 30th.

There are more problems here that we could be fixing with larger refactors (see BPO-44587 for details) but this trivial change is a clear improvement over what we currently ship with.

@@ -875,7 +875,7 @@ def __init__(self,
_option_strings.append(option_string)

if help is not None and default is not None:
help += f" (default: {default})"
help += " (default: %(default)s)"
Copy link
Contributor

@ambv ambv Aug 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pablogsal, this works since the help string is treated as a formatting string (and presence of '%(default)' is detected). That way default display isn't duplicated.

@miss-islington miss-islington merged commit 6f6648e into python:3.10 Aug 17, 2021
14 checks passed
@miss-islington miss-islington deleted the backport-1512bc2-3.10 branch Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants