diff options
author | R David Murray <rdmurray@bitdance.com> | 2012-07-21 22:48:35 -0400 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2012-07-21 22:48:35 -0400 |
commit | 00528e8fec37bdf203bdb172ec3363353268d908 (patch) | |
tree | d2dc1bd67f033623d726f07d53018fa5a7d6b848 /Lib/argparse.py | |
parent | b94082a71b6b141cdcdde52a0f01b10f9334b5a8 (diff) | |
download | cpython-git-00528e8fec37bdf203bdb172ec3363353268d908.tar.gz |
#13922: argparse no longer incorrectly strips '--' after the first one.
Patch by Jeff Knupp.
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r-- | Lib/argparse.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py index 25803b3519..0ee8c0865e 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -2186,9 +2186,12 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): # Value conversion methods # ======================== def _get_values(self, action, arg_strings): - # for everything but PARSER args, strip out '--' + # for everything but PARSER, REMAINDER args, strip out first '--' if action.nargs not in [PARSER, REMAINDER]: - arg_strings = [s for s in arg_strings if s != '--'] + try: + arg_strings.remove('--') + except ValueError: + pass # optional argument produces a default when not present if not arg_strings and action.nargs == OPTIONAL: |