gh-138525: raise error when BooleanOptionalAction used with prefix_chars without '-'#138526
gh-138525: raise error when BooleanOptionalAction used with prefix_chars without '-'#138526mattwang44 wants to merge 8 commits intopython:mainfrom
Conversation
…x_chars without '-'
|
Would like to add NEWS.d to use blurb tool? |
|
Isn't it too late? It raises an error when the option is used, not when it is defined. |
I find it difficult to achieve this without changing the interface. I've added a generic |
Misc/NEWS.d/next/Library/2025-09-05-15-42-16.gh-issue-138525.ngZ0qT.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: sobolevn <mail@sobolevn.me>
|
Thank you for your PR, @mattwang44, but after adding support of alternate prefix chars in #138692 this check is no longer needed. |
|
Hey @mattwang44! Thanks for opening the original issue and opening a PR! If you're interested in continuing to contribute to argparse, we have a project board tracking open argparse issues that could use attention. There are issues ranging from small fixes/good first issues to larger enhancements, and I'm happy to help guide you through any of them if you'd like to pick something up. Thanks again for your contribution, and I hope to see more PRs from you in the future! |
(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