diff options
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r-- | Lib/argparse.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py index 89496cbe454..3974ebedabe 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1532,9 +1532,8 @@ class _ActionsContainer(object): # mark positional arguments as required if at least one is # always required - if kwargs.get('nargs') not in [OPTIONAL, ZERO_OR_MORE]: - kwargs['required'] = True - if kwargs.get('nargs') == ZERO_OR_MORE and 'default' not in kwargs: + nargs = kwargs.get('nargs') + if nargs not in [OPTIONAL, ZERO_OR_MORE, REMAINDER, SUPPRESS, 0]: kwargs['required'] = True # return the keyword arguments with no option strings |