summaryrefslogtreecommitdiffstats
path: root/Lib/argparse.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-07-22 02:56:49 (GMT)
committerR David Murray <rdmurray@bitdance.com>2012-07-22 02:56:49 (GMT)
commit45ccf032beb03aab5e35b1ae6b1c38252506fde0 (patch)
tree5a3f5fd5c546765fa78d63259fcdc4f9e1d901df /Lib/argparse.py
parentd4703d1d85fc00aeb8f46d945ce7b34606604992 (diff)
parent00528e8fec37bdf203bdb172ec3363353268d908 (diff)
downloadcpython-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.py7
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: