bpo-29298: Fix crash with required subparsers without dest (GH-3680) (GH-27304)

(cherry picked from commit 17575f73ce)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
This commit is contained in:
Miss Islington (bot) 2021-07-23 06:27:17 -07:00 committed by GitHub
parent 0f55d21212
commit 097801844c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 0 deletions

View file

@ -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