New submission from MaT1g3R :
If I run this script with -h
-8<--
from argparse import ArgumentParser
mapping = ['123456', '12345', '12345', '123']
p = ArgumentParser('11')
p.add_argument('-v', '--verbose', help='verbose mode', action='store_true')
p.add_argument('targets', help='installation targets', nargs='+',
metavar='\n'.join(mapping))
p.parse_args()
-8<
I get an error:
-8<
Traceback (most recent call last):
File "tmp.py", line 7, in
p.parse_args()
File "/usr/lib/python3.6/argparse.py", line 1730, in parse_args
args, argv = self.parse_known_args(args, namespace)
File "/usr/lib/python3.6/argparse.py", line 1762, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
File "/usr/lib/python3.6/argparse.py", line 1968, in _parse_known_args
start_index = consume_optional(start_index)
File "/usr/lib/python3.6/argparse.py", line 1908, in consume_optional
take_action(action, args, option_string)
File "/usr/lib/python3.6/argparse.py", line 1836, in take_action
action(self, namespace, argument_values, option_string)
File "/usr/lib/python3.6/argparse.py", line 1020, in __call__
parser.print_help()
File "/usr/lib/python3.6/argparse.py", line 2362, in print_help
self._print_message(self.format_help(), file)
File "/usr/lib/python3.6/argparse.py", line 2346, in format_help
return formatter.format_help()
File "/usr/lib/python3.6/argparse.py", line 282, in format_help
help = self._root_section.format_help()
File "/usr/lib/python3.6/argparse.py", line 213, in format_help
item_help = join([func(*args) for func, args in self.items])
File "/usr/lib/python3.6/argparse.py", line 213, in
item_help = join([func(*args) for func, args in self.items])
File "/usr/lib/python3.6/argparse.py", line 334, in _format_usage
assert ' '.join(pos_parts) == pos_usage
AssertionError
-8<--
--
components: Library (Lib)
messages: 312299
nosy: MaT1g3R
priority: normal
severity: normal
status: open
title: argparse assertion failure with multiline metavars
type: behavior
versions: Python 3.6
___
Python tracker
<https://bugs.python.org/issue32867>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com