This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author AbcSxyZ
Recipients AbcSxyZ, lys.nikolaou, pablogsal
Date 2021-10-22.19:31:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1634931090.99.0.410236903356.issue45580@roundup.psfhosted.org>
In-reply-to
Content
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]
```
History
Date User Action Args
2021-10-22 19:31:31AbcSxyZsetrecipients: + AbcSxyZ, lys.nikolaou, pablogsal
2021-10-22 19:31:30AbcSxyZsetmessageid: <1634931090.99.0.410236903356.issue45580@roundup.psfhosted.org>
2021-10-22 19:31:30AbcSxyZlinkissue45580 messages
2021-10-22 19:31:30AbcSxyZcreate