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

Automerge-Triggered-By: GH:encukou
This commit is contained in:
Anthony Sottile 2021-07-23 08:49:04 -04:00 committed by GitHub
parent fe13f0b0f6
commit 17575f73ce
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