paul j3 added the comment:
Steven's patch (subparse_optionals.diff) run with jakub's test case
(argparse_subparses_ambiguous_bug.py) works. But if the input string is
print(parser.parse_args('--foo baz'.split()))
produces
Namespace(cmd=None, foo='baz', foo1=None, foo2=None)
(I added the 'cmd' subparse 'dest').
Two things seem to be going on now:
1) '--foo' is being parsed even though its subparser is not invoked,
2) and the subparser is not required.
The issue of whether subparsers are required or not is another issue. They
used to be required, but the testing for 'required' was changed, and subparsers
fell through the crack.
I suspect that if the missing subparser error were raised, the first issue
wouldn't be apparent.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue14365>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com