summaryrefslogtreecommitdiffstats
path: root/Lib/argparse.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r--Lib/argparse.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py
index e45b67b..a300828 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -593,7 +593,10 @@ class HelpFormatter(object):
elif action.nargs == SUPPRESS:
result = ''
else:
- formats = ['%s' for _ in range(action.nargs)]
+ try:
+ formats = ['%s' for _ in range(action.nargs)]
+ except TypeError:
+ raise ValueError("invalid nargs value") from None
result = ' '.join(formats) % get_metavar(action.nargs)
return result
@@ -850,7 +853,7 @@ class _StoreAction(Action):
help=None,
metavar=None):
if nargs == 0:
- raise ValueError('nargs for store actions must be > 0; if you '
+ raise ValueError('nargs for store actions must be != 0; if you '
'have nothing to store, actions such as store '
'true or store const may be more appropriate')
if const is not None and nargs != OPTIONAL:
@@ -942,7 +945,7 @@ class _AppendAction(Action):
help=None,
metavar=None):
if nargs == 0:
- raise ValueError('nargs for append actions must be > 0; if arg '
+ raise ValueError('nargs for append actions must be != 0; if arg '
'strings are not supplying the value to append, '
'the append const action may be more appropriate')
if const is not None and nargs != OPTIONAL: