summaryrefslogtreecommitdiffstats
path: root/Lib/argparse.py
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2021-07-23 12:49:04 (GMT)
committerGitHub <noreply@github.com>2021-07-23 12:49:04 (GMT)
commit17575f73ce2cb9f3a4eb4cc416c690f9a4e7205c (patch)
treeaae5b349852e301f25d191e5408b562e7028e953 /Lib/argparse.py
parentfe13f0b0f696464dd6f283576668dbf57cb11399 (diff)
downloadcpython-17575f73ce2cb9f3a4eb4cc416c690f9a4e7205c.zip
cpython-17575f73ce2cb9f3a4eb4cc416c690f9a4e7205c.tar.gz
cpython-17575f73ce2cb9f3a4eb4cc416c690f9a4e7205c.tar.bz2
bpo-29298: Fix crash with required subparsers without dest (GH-3680)
Automerge-Triggered-By: GH:encukou
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r--Lib/argparse.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py
index 8a12dea..e3a49e7 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -727,6 +727,8 @@ def _get_action_name(argument):
return argument.metavar
elif argument.dest not in (None, SUPPRESS):
return argument.dest
+ elif argument.choices:
+ return '{' + ','.join(argument.choices) + '}'
else:
return None