Message245297
>>> import argparse
>>>
>>> parser = argparse.ArgumentParser()
>>> _ = parser.add_argument('foo', choices=[], help='%(choices)s')
>>> parser.print_help()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/guest/tmp/tests/misc/git/example/cpython/main/Lib/argparse.py", line 2358, in print_help
self._print_message(self.format_help(), file)
File "/home/guest/tmp/tests/misc/git/example/cpython/main/Lib/argparse.py", line 2342, in format_help
return formatter.format_help()
File "/home/guest/tmp/tests/misc/git/example/cpython/main/Lib/argparse.py", line 278, in format_help
help = self._root_section.format_help()
File "/home/guest/tmp/tests/misc/git/example/cpython/main/Lib/argparse.py", line 208, in format_help
func(*args)
File "/home/guest/tmp/tests/misc/git/example/cpython/main/Lib/argparse.py", line 208, in format_help
func(*args)
File "/home/guest/tmp/tests/misc/git/example/cpython/main/Lib/argparse.py", line 517, in _format_action
parts.append('%*s%s\n' % (indent_first, '', help_lines[0]))
IndexError: list index out of range
>>>
It's not very useful to print empty choices, but the choices list could be formed dynamically. So the command-line user can't figure out what's happen. |
|
Date |
User |
Action |
Args |
2015-06-13 06:47:02 | py.user | set | recipients:
+ py.user |
2015-06-13 06:47:02 | py.user | set | messageid: <1434178022.79.0.230343884775.issue24444@psf.upfronthosting.co.za> |
2015-06-13 06:47:02 | py.user | link | issue24444 messages |
2015-06-13 06:47:02 | py.user | create | |
|