This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients bethard, eric.araujo, jakub, paul.j3, tshepang
Date 2013-09-26.23:04:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1380236659.69.0.466095626084.issue14365@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-09-26 23:04:19paul.j3setrecipients: + paul.j3, bethard, eric.araujo, tshepang, jakub
2013-09-26 23:04:19paul.j3setmessageid: <1380236659.69.0.466095626084.issue14365@psf.upfronthosting.co.za>
2013-09-26 23:04:19paul.j3linkissue14365 messages
2013-09-26 23:04:19paul.j3create