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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2455,7 +2455,7 @@ def parse_known_intermixed_args(self, args=None, namespace=None):
# ========================
def _get_values(self, action, arg_strings):
# for everything but PARSER, REMAINDER args, strip out first '--'
if action.nargs not in [PARSER, REMAINDER]:
if action.nargs not in [PARSER, REMAINDER, ZERO_OR_MORE, ONE_OR_MORE]:
try:
arg_strings.remove('--')
except ValueError:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed an issue where multiple "--" arguments were not returned by
`ArgumentParser`. Pathch by Robert O'Shea