From 00528e8fec37bdf203bdb172ec3363353268d908 Mon Sep 17 00:00:00 2001 From: R David Murray Date: Sat, 21 Jul 2012 22:48:35 -0400 Subject: #13922: argparse no longer incorrectly strips '--' after the first one. Patch by Jeff Knupp. --- Lib/argparse.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Lib/argparse.py') 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: -- cgit v1.2.1