diff options
author | R David Murray <rdmurray@bitdance.com> | 2012-07-22 02:56:49 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2012-07-22 02:56:49 (GMT) |
commit | 45ccf032beb03aab5e35b1ae6b1c38252506fde0 (patch) | |
tree | 5a3f5fd5c546765fa78d63259fcdc4f9e1d901df /Lib/argparse.py | |
parent | d4703d1d85fc00aeb8f46d945ce7b34606604992 (diff) | |
parent | 00528e8fec37bdf203bdb172ec3363353268d908 (diff) | |
download | cpython-45ccf032beb03aab5e35b1ae6b1c38252506fde0.zip cpython-45ccf032beb03aab5e35b1ae6b1c38252506fde0.tar.gz cpython-45ccf032beb03aab5e35b1ae6b1c38252506fde0.tar.bz2 |
Merge #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 74c456f..cc3e374 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -2189,9 +2189,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: |