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

bpo-46080: Fix crash when argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS and help specified #30111

Merged
merged 3 commits into from Jan 20, 2022

Conversation

felixfontein
Copy link
Contributor

@felixfontein felixfontein commented Dec 15, 2021

When argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS and help specified, help text composition currently crashes. This PR fixes that by also checking whether default is not SUPPRESS before appending %(default)s to help.

https://bugs.python.org/issue46080

… default=argparse.SUPPRESS and help specified.
@the-knights-who-say-ni
Copy link

the-knights-who-say-ni commented Dec 15, 2021

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@felixfontein

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

Copy link
Contributor

@taleinat taleinat left a comment

Looks good to me, but I suggest some minor changes to the NEWS entry.

@bedevere-bot
Copy link

bedevere-bot commented Jan 8, 2022

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

felixfontein and others added 2 commits Jan 8, 2022
Co-authored-by: Tal Einat <532281+taleinat@users.noreply.github.com>
@taleinat taleinat added type-bug An unexpected behavior, bug, or error awaiting merge and removed awaiting changes labels Jan 20, 2022
@taleinat taleinat merged commit 9e87c0e into python:main Jan 20, 2022
13 checks passed
@miss-islington
Copy link
Contributor

miss-islington commented Jan 20, 2022

Thanks @felixfontein for the PR, and @taleinat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 20, 2022
…nGH-30111)

Fix an uncaught exception during help text generation when
argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS
and help is specified.
(cherry picked from commit 9e87c0e)

Co-authored-by: Felix Fontein <felix@fontein.de>
@bedevere-bot
Copy link

bedevere-bot commented Jan 20, 2022

GH-30730 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 20, 2022
…nGH-30111)

Fix an uncaught exception during help text generation when
argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS
and help is specified.
(cherry picked from commit 9e87c0e)

Co-authored-by: Felix Fontein <felix@fontein.de>
@bedevere-bot
Copy link

bedevere-bot commented Jan 20, 2022

GH-30731 is a backport of this pull request to the 3.9 branch.

miss-islington added a commit that referenced this pull request Jan 20, 2022
)

Fix an uncaught exception during help text generation when
argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS
and help is specified.
(cherry picked from commit 9e87c0e)

Co-authored-by: Felix Fontein <felix@fontein.de>
miss-islington added a commit that referenced this pull request Jan 20, 2022
)

Fix an uncaught exception during help text generation when
argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS
and help is specified.
(cherry picked from commit 9e87c0e)

Co-authored-by: Felix Fontein <felix@fontein.de>
@felixfontein felixfontein deleted the fix-argparse-crash branch Jan 21, 2022
@felixfontein
Copy link
Contributor Author

felixfontein commented Jan 21, 2022

@taleinat thanks for reviewing and merging this!

hello-adam pushed a commit to hello-adam/cpython that referenced this pull request Jun 2, 2022
…nGH-30111)

Fix an uncaught exception during help text generation when
argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS
and help is specified.
(cherry picked from commit 9e87c0e)

Co-authored-by: Felix Fontein <felix@fontein.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants