[New-bugs-announce] [issue45656] argparse bug: prefix_chars argument to add_argument_group doesn't really work
Samwyse
report at bugs.python.org
Thu Oct 28 14:27:12 EDT 2021
New submission from Samwyse <samwyse at gmail.com>:
Using the prefix_chars argument to parser.add_argument_group causes usage information to print correctly, but the resulting parser doesn't recognize the options. The included program reproduces the issue; it produces the following output on my system.
--- python version
3.6.8 (default, Sep 26 2019, 11:57:09)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
--- test using prefix_chars='-/' with ArgumentParser
--- show help info
usage: test-1 [-h] [-foo FOO] [/bar BAR]
optional arguments:
-h, --help show this help message and exit
-foo FOO
/bar BAR
--- try parsing something
Namespace(bar='b', foo='f')
--- test using prefix_chars='-/' with an argument group
--- show help info
usage: test-2 [-h] [-foo FOO] [/bar BAR]
optional arguments:
-h, --help show this help message and exit
other arguments:
-foo FOO
/bar BAR
--- try parsing something
usage: test-2 [-h] [-foo FOO] [/bar BAR]
test-2: error: unrecognized arguments: /bar b
----------
components: Library (Lib)
files: argparser-bug.py
messages: 405217
nosy: samwyse
priority: normal
severity: normal
status: open
title: argparse bug: prefix_chars argument to add_argument_group doesn't really work
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file50410/argparser-bug.py
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45656>
_______________________________________
More information about the New-bugs-announce
mailing list