summaryrefslogtreecommitdiffstats
path: root/Lib/argparse.py
diff options
context:
space:
mode:
authorSteven Bethard <steven.bethard@gmail.com>2010-11-01 15:57:36 (GMT)
committerSteven Bethard <steven.bethard@gmail.com>2010-11-01 15:57:36 (GMT)
commit1ca45a5292a382d5902b80de5c8274994a985e84 (patch)
treea27a52333253ed1f82246d295fcf3bb69ce0aa32 /Lib/argparse.py
parent6509599056bb1d4fcd9e071d641715846977de8b (diff)
downloadcpython-1ca45a5292a382d5902b80de5c8274994a985e84.zip
cpython-1ca45a5292a382d5902b80de5c8274994a985e84.tar.gz
cpython-1ca45a5292a382d5902b80de5c8274994a985e84.tar.bz2
Fix bug 9352 where characters were being lost in parsing some short options
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r--Lib/argparse.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py
index fa3b377..223790c 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -1794,13 +1794,13 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
chars = self.prefix_chars
if arg_count == 0 and option_string[1] not in chars:
action_tuples.append((action, [], option_string))
- for char in self.prefix_chars:
- option_string = char + explicit_arg[0]
- explicit_arg = explicit_arg[1:] or None
- optionals_map = self._option_string_actions
- if option_string in optionals_map:
- action = optionals_map[option_string]
- break
+ char = option_string[0]
+ option_string = char + explicit_arg[0]
+ new_explicit_arg = explicit_arg[1:] or None
+ optionals_map = self._option_string_actions
+ if option_string in optionals_map:
+ action = optionals_map[option_string]
+ explicit_arg = new_explicit_arg
else:
msg = _('ignored explicit argument %r')
raise ArgumentError(action, msg % explicit_arg)