summaryrefslogtreecommitdiffstats
path: root/Lib/argparse.py
diff options
context:
space:
mode:
authorFelix Fontein <felix@fontein.de>2022-01-20 22:48:48 (GMT)
committerGitHub <noreply@github.com>2022-01-20 22:48:48 (GMT)
commit9e87c0e03fa501fb90008547983ce4c1dcaaf90c (patch)
tree8759fddb2025377171f850470e6f76d0ddf56993 /Lib/argparse.py
parent30fb6d073d9ca00dff8e4155c523cdfa63abab6b (diff)
downloadcpython-9e87c0e03fa501fb90008547983ce4c1dcaaf90c.zip
cpython-9e87c0e03fa501fb90008547983ce4c1dcaaf90c.tar.gz
cpython-9e87c0e03fa501fb90008547983ce4c1dcaaf90c.tar.bz2
bpo-46080: fix argparse help generation exception in edge case (GH-30111)
Fix an uncaught exception during help text generation when argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS and help is specified.
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r--Lib/argparse.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py
index 1529d9e..9344dab 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -881,7 +881,7 @@ class BooleanOptionalAction(Action):
option_string = '--no-' + option_string[2:]
_option_strings.append(option_string)
- if help is not None and default is not None:
+ if help is not None and default is not None and default is not SUPPRESS:
help += " (default: %(default)s)"
super().__init__(