mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.13] gh-80259: Fix conflict between type and default=SUPPRESS in argparse (GH-124519) (GH-124751)
type() no longer called for SUPPRESS.
This only affects positional arguments with nargs='?'.
(cherry picked from commit 9bcadf589a
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
aa648c21e9
commit
f28906e58e
3 changed files with 16 additions and 8 deletions
|
@ -2508,7 +2508,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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue