paul j3 <ajipa...@gmail.com> added the comment:

The error is raised in ._get_values with this section:

        # when nargs='*' on a positional, if there were no command-line
        # args, use the default if it is anything other than None
        elif (not arg_strings and action.nargs == ZERO_OR_MORE and
              not action.option_strings):
            if action.default is not None:
                value = action.default
            else:
                value = arg_strings
            self._check_value(action, value)

An empty 'arg_strings' satisfies the nargs='*', so 'value' is set to that, and 
passed to _check_value.

We could avoid this by setting the default to one of the valid choices, e.g. 
'a'.  But then the attribute would be that string, not a list with that string.

I suspect this issue has come up before, since I don't this code has been 
changed in a long time.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41047>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to