summaryrefslogtreecommitdiff
path: root/Lib/argparse.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-07-21 22:54:34 -0400
committerR David Murray <rdmurray@bitdance.com>2012-07-21 22:54:34 -0400
commit68f555c03ad32671a76c5762313bbf33c0ae4842 (patch)
tree4fd78965110f50273e49c1e38a18a29e77cb3cde /Lib/argparse.py
parent056c31f9cc10a8697a40c817eae42f7e38a1cf80 (diff)
downloadcpython-git-68f555c03ad32671a76c5762313bbf33c0ae4842.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.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py
index f365385a57..80df97b4f0 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -2174,9 +2174,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: