Skip to content

gh-95468: Fixes issue with ArgumentParser skipping '--' options #95489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

PurityLake
Copy link
Contributor

@PurityLake PurityLake commented Jul 31, 2022

Fixes #95468

ArgumentParser does not pass over '--' characters when nargs is set to *, + or ... now.

Example program:

import argparse

for nargs in [ '+', '*', '...' ]:
    p = argparse.ArgumentParser()
    p.add_argument('arg1', type=str)
    p.add_argument('args', nargs=nargs)
    p.add_argument('arg2', type=str)
    print(p.parse_args(['foo', '--', '--bar', '--', 'com', "last"]))

@PurityLake PurityLake closed this Jul 31, 2022
@PurityLake PurityLake deleted the fix-issue-95468 branch July 31, 2022 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

argparse.ArgumentParser silently swallows multiple -- (double dash)
2 participants