Mercurial > cpython-lru_cache-weakref
diff Lib/argparse.py @ 78233:bd2c167dfabc 2.7
#13922: argparse no longer incorrectly strips '--' after the first one.
Patch by Jeff Knupp.
| author | R David Murray <rdmurray@bitdance.com> |
|---|---|
| date | Sat, 21 Jul 2012 22:54:34 -0400 |
| parents | c9806f0aaefb |
| children | 62b5667ef2f4 |
line wrap: on
line diff
--- a/Lib/argparse.py Sat Jul 21 22:35:00 2012 -0400 +++ b/Lib/argparse.py Sat Jul 21 22:54:34 2012 -0400 @@ -2174,9 +2174,12 @@ # 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:
