summaryrefslogtreecommitdiffstats
path: root/Lib/argparse.py
diff options
context:
space:
mode:
authorSteven Bethard <steven.bethard@gmail.com>2010-11-01 16:29:26 (GMT)
committerSteven Bethard <steven.bethard@gmail.com>2010-11-01 16:29:26 (GMT)
commit49998eec49f16262381219eb43dcb58bbe092842 (patch)
treed40bdfbc29ac2d3538a27eadd05c8c9b8101bfcf /Lib/argparse.py
parent1ca45a5292a382d5902b80de5c8274994a985e84 (diff)
downloadcpython-49998eec49f16262381219eb43dcb58bbe092842.zip
cpython-49998eec49f16262381219eb43dcb58bbe092842.tar.gz
cpython-49998eec49f16262381219eb43dcb58bbe092842.tar.bz2
Fix for issue 9355 where with multiple mutually exclusive arguments, some brackets were being lost in the usage messages
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r--Lib/argparse.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py
index 223790c..38dd8e6 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -392,10 +392,16 @@ class HelpFormatter(object):
for action in group._group_actions:
group_actions.add(action)
if not group.required:
- inserts[start] = '['
+ if start in inserts:
+ inserts[start] += ' ['
+ else:
+ inserts[start] = '['
inserts[end] = ']'
else:
- inserts[start] = '('
+ if start in inserts:
+ inserts[start] += ' ('
+ else:
+ inserts[start] = '('
inserts[end] = ')'
for i in range(start + 1, end):
inserts[i] = '|'