diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-08-25 21:30:49 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2019-08-25 21:30:49 (GMT) |
commit | 31ea447ffe591736af1d7a3178c0f7ca3eb50d70 (patch) | |
tree | 805a0008da12afe57497eae7c98c15680326099e /Lib/argparse.py | |
parent | f2b468dd6d0bdbe2e87c0ca7515800a115e95e54 (diff) | |
download | cpython-31ea447ffe591736af1d7a3178c0f7ca3eb50d70.zip cpython-31ea447ffe591736af1d7a3178c0f7ca3eb50d70.tar.gz cpython-31ea447ffe591736af1d7a3178c0f7ca3eb50d70.tar.bz2 |
bpo-29553: Fix ArgumentParser.format_usage() for mutually exclusive groups (GH-14976)
Co-authored-by: Andrew Nester <andrew.nester.dev@gmail.com>
Co-authored-by: Flavian Hautbois <flavianh@sicara.com>
(cherry picked from commit da27d9b9dc44913ffee8f28d9638985eaaa03755)
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r-- | Lib/argparse.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py index a030749..24af355 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -407,13 +407,19 @@ class HelpFormatter(object): inserts[start] += ' [' else: inserts[start] = '[' - inserts[end] = ']' + if end in inserts: + inserts[end] += ']' + else: + inserts[end] = ']' else: if start in inserts: inserts[start] += ' (' else: inserts[start] = '(' - inserts[end] = ')' + if end in inserts: + inserts[end] += ')' + else: + inserts[end] = ')' for i in range(start + 1, end): inserts[i] = '|' |