{{ message }}
gh-138525: raise error when BooleanOptionalAction used with prefix_chars without '-'#138526
Closed
mattwang44 wants to merge 8 commits into
Closed
gh-138525: raise error when BooleanOptionalAction used with prefix_chars without '-'#138526mattwang44 wants to merge 8 commits into
mattwang44 wants to merge 8 commits into
Conversation
…x_chars without '-'
Member
Member
|
Isn't it too late? It raises an error when the option is used, not when it is defined. |
Contributor
Author
I find it difficult to achieve this without changing the interface. I've added a generic |
sobolevn
reviewed
Sep 8, 2025
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: sobolevn <mail@sobolevn.me>
Member
|
Thank you for your PR, @mattwang44, but after adding support of alternate prefix chars in #138692 this check is no longer needed. |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

(this contribution is made during PyCon TW sprint)
fixes #138525. Here's the output of my local build with this patch.
I believe the description of
BooleanOptionalActionon the argparse doc has already implied that it should be used with prefix_chars containing '-', so I didn't make any change to the docs.argparse.BooleanOptionalActionsilently failed when used with parser whoseprefix_charshas no'-'#138525