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, elsdoerfer, eric.araujo, paul.j3, r.david.murray
Date 2014-07-07.17:12:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1404753175.85.0.93705569942.issue9571@psf.upfronthosting.co.za>
In-reply-to
Content
This patch modifies that '--' handling from 13922, removing '--' from PARSER and REMAINDER if it is the first string:

        if action.nargs not in [PARSER, REMAINDER]:
            try:
                arg_strings.remove('--')
            except ValueError:
                pass
        else:
            # remove '--' if it is the first string, issue9571
            if arg_strings and arg_strings[0] == '--':
                arg_strings = arg_strings[1:]

Doing this for PARSER addresses this issue, and should not have any backward compatibility issues, since starting a 'A...' list with '--' does not make sense.

The argument for doing this with REMAINDER is a bit weaker.  I can't think of why a user would expect or want an initial '--', but someone might have written code to compensate for this flaw.

test_argparse has 2 new tests, added at the end of the subparsers class.  The one for subparser has to contend with a bug that makes subparsers optional (http://bugs.python.org/issue9253).  The REMAINDER one is clearly related, though it doesn't fit the test class theme.
History
Date User Action Args
2014-07-07 17:12:55paul.j3setrecipients: + paul.j3, bethard, eric.araujo, r.david.murray, elsdoerfer
2014-07-07 17:12:55paul.j3setmessageid: <1404753175.85.0.93705569942.issue9571@psf.upfronthosting.co.za>
2014-07-07 17:12:55paul.j3linkissue9571 messages
2014-07-07 17:12:55paul.j3create