diff options
author | Steven Bethard <steven.bethard@gmail.com> | 2010-11-01 15:59:35 (GMT) |
---|---|---|
committer | Steven Bethard <steven.bethard@gmail.com> | 2010-11-01 15:59:35 (GMT) |
commit | 784dd51ad297d31ee724f38a528ba8472e4b14f9 (patch) | |
tree | e714c18ac08124df0d72795464925bfdc665594a /Lib/argparse.py | |
parent | 931906a7f5974865c9e928332eb6dd8ba10a91c7 (diff) | |
download | cpython-784dd51ad297d31ee724f38a528ba8472e4b14f9.zip cpython-784dd51ad297d31ee724f38a528ba8472e4b14f9.tar.gz cpython-784dd51ad297d31ee724f38a528ba8472e4b14f9.tar.bz2 |
Merged revisions 86090 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86090 | steven.bethard | 2010-11-01 16:57:36 +0100 (Mon, 01 Nov 2010) | 1 line
Fix bug 9352 where characters were being lost in parsing some short options
........
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r-- | Lib/argparse.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py index d5bc16c..9597a67 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1796,13 +1796,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) |