summaryrefslogtreecommitdiffstats
path: root/Lib/argparse.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-09-29 07:47:06 (GMT)
committerGitHub <noreply@github.com>2024-09-29 07:47:06 (GMT)
commit9bcadf589ab6f7b9d309290de7a80156b6905d35 (patch)
treee910e672f213c47e4ed7a2949fa9da1c8bfc4487 /Lib/argparse.py
parent49e105f9488de18d3d92948232fcbd956cbe0c6e (diff)
downloadcpython-9bcadf589ab6f7b9d309290de7a80156b6905d35.zip
cpython-9bcadf589ab6f7b9d309290de7a80156b6905d35.tar.gz
cpython-9bcadf589ab6f7b9d309290de7a80156b6905d35.tar.bz2
gh-80259: Fix conflict between type and default=SUPPRESS in argparse (GH-124519)
type() no longer called for SUPPRESS. This only affects positional arguments with nargs='?'.
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 4506a5e..3c2023e 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -2483,7 +2483,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
value = action.const
else:
value = action.default
- if isinstance(value, str):
+ if isinstance(value, str) and value is not SUPPRESS:
value = self._get_value(action, value)
self._check_value(action, value)