[issue16977] argparse: mismatch between choices parsing and usage/error message
paul j3
report at bugs.python.org
Thu Jul 4 17:09:04 CEST 2013
paul j3 added the comment:
Changing _check_value from:
def _check_value(self, action, value):
# converted value must be one of the choices (if specified)
if action.choices is not None and value not in action.choices:
...
to
def _check_value(self, action, value):
# converted value must be one of the choices (if specified)
if action.choices is not None:
choices = action.choices
if isinstance(choices, str):
choices = list(choices)
if value not in action.choices:
...
would correct the string search without affecting other types of choices.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16977>
_______________________________________
More information about the Python-bugs-list
mailing list