New submission from AbcSxyZ <[email protected]>:
Hi,
I'm getting a kind of undefined behavior where parenthesis seem handled in a
strange way. On display, it has a conflict between parenthesis of the option,
and nested parenthesis within a metavar.
## Reproduction script
```
import argparse
def main():
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("-p", "--path", metavar="/var/www/html",
help="DocumentRoot path")
group.add_argument("-r", "--reverse", metavar="http)s(://Host:Port",
help="Reverse proxy address")
parser.add_argument("--last-args")
return parser.parse_args()
main()
```
## Output of help menu
```
usage: crash.py [-h] (-p /var/www/html | -r http)s://Host:Port [--last-args
LAST_ARGS]
```
## Expected behavior
```
usage: crash.py [-h] (-p /var/www/html | -r http)s(://Host:Port) [--last-args
LAST_ARGS]
```
----------
components: Parser
messages: 404815
nosy: AbcSxyZ, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: argparse.ArgumentParser.add_mutually_exclusive_group : metavar create
parenthesis undefined behavior
versions: Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45580>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com