gh-117941: Reject option names starting with "--no-" in argparse.BooleanOptionalAction#125894
Conversation
…e.BooleanOptionalAction They never worked correctly.
51bbf5e to
714c456
Compare
There was a problem hiding this comment.
LGTM, but I think we should also update the documentation to reflect that --no-foo is no longer supported, right? The blurb from the docs:
You may also specify an arbitrary action by passing an Action subclass or other object that implements the same interface. The BooleanOptionalAction is available in argparse and adds support for boolean actions such as --foo and --no-foo:
|
It never was supported. Just now you will get an error instead of wrong result when you use BooleanOptionalAction in the way it was not supposed to be used. |
|
Right, but isn't the text I mentioned above suggesting that |
Read it in the context. The following example shows that it creates action for |
|
Yeah, I see the example. It just sort of reads a bit unclear to me and implies that I should be able to create a parser with: |
|
I do not see anything that implies that '--no-foo' works. And it never worked. |
|
Thank you for your review @savannahostrowski. |
…e.BooleanOptionalAction (pythonGH-125894) They never worked correctly.
…e.BooleanOptionalAction (pythonGH-125894) They never worked correctly.
They never worked correctly.