summaryrefslogtreecommitdiff
path: root/argparse.py
diff options
context:
space:
mode:
authorsteven.bethard <devnull@localhost>2009-12-07 00:56:45 +0000
committersteven.bethard <devnull@localhost>2009-12-07 00:56:45 +0000
commit595bce353fc65c44168df31a9cd3e29b9059b486 (patch)
tree00044595d631f68c64a1ce75fa68aa0c7ac1e36f /argparse.py
parentd8a9e95d1809e508aa8720b26e98510ef414aa0e (diff)
downloadargparse-595bce353fc65c44168df31a9cd3e29b9059b486.tar.gz
Fix bug where --si=64 was deemed ambiguous when both --si and --size were in the parser.
Diffstat (limited to 'argparse.py')
-rw-r--r--argparse.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/argparse.py b/argparse.py
index 16a778f..8b96e62 100644
--- a/argparse.py
+++ b/argparse.py
@@ -2036,6 +2036,13 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
action = self._option_string_actions[arg_string]
return action, arg_string, None
+ # if the option string before the "=" is present, return the action
+ if '=' in arg_string:
+ option_string, explicit_arg = arg_string.split('=', 1)
+ if option_string in self._option_string_actions:
+ action = self._option_string_actions[option_string]
+ return action, option_string, explicit_arg
+
# search through all possible prefixes of the option string
# and all actions in the parser for possible interpretations
option_tuples = self._get_option_tuples(arg_string)