Message 196434 - Python tracker

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.

Content
These three changes end up testing for the same thing. The initial 'if' catches different test cases.  'subparsers' or 'remainder' might 'confuse' the 'O' test.  The zero-width test ends up weeding out everything but the test cases added for this issue.

    # if we haven't hit the end of the command line strings,
    if start_index + sum(arg_counts) != len(arg_strings_pattern):
        while arg_counts and arg_counts[-1] == 0: 
            arg_counts.pop()

    # same test using selected_pattern (= arg_strings_pattern[start_index:])
    if len(selected_pattern) != sum(arg_counts):
        while arg_counts and arg_counts[-1] == 0: 
            arg_counts.pop()

    # alt test: test for optional in the remaining pattern
    if 'O' in selected_pattern:
        while arg_counts and arg_counts[-1] == 0: 
            arg_counts.pop()