This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients jameshcorbett, paul.j3, rhettinger
Date 2020-06-21.03:17:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1592709474.47.0.964910869548.issue41047@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-06-21 03:17:54paul.j3setrecipients: + paul.j3, rhettinger, jameshcorbett
2020-06-21 03:17:54paul.j3setmessageid: <1592709474.47.0.964910869548.issue41047@roundup.psfhosted.org>
2020-06-21 03:17:54paul.j3linkissue41047 messages
2020-06-21 03:17:53paul.j3create