Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
Prior to Python 3.13, long usage text of arguments in mutually exclusive groups would wrap to multiple lines. This is no longer the case in Python 3.13:
importargparseparser=argparse.ArgumentParser(prog="PROG",formatter_class=lambdaprog:argparse.HelpFormatter(prog,width=80))meg=parser.add_mutually_exclusive_group()meg.add_argument("--op1",metavar="MET",nargs="?")meg.add_argument("--op2",metavar=("MET1","MET2"),nargs="*")meg.add_argument("--op3",nargs="*")meg.add_argument("--op4",metavar=("MET1","MET2"),nargs="+")meg.add_argument("--op5",nargs="+")meg.add_argument("--op6",nargs=3)meg.add_argument("--op7",metavar=("MET1","MET2","MET3"),nargs=3)parser.print_help()
Python 3.12 output:
usage: PROG [-h] [--op1 [MET] | --op2 [MET1 [MET2 ...]] | --op3 [OP3 ...] | --op4 MET1 [MET2 ...] | --op5 OP5 [OP5 ...] | --op6 OP6 OP6 OP6 | --op7 MET1 MET2 MET3]Python 3.13 output:
usage: PROG [-h] [--op1 [MET] | --op2 [MET1 [MET2 ...]] | --op3 [OP3 ...] | --op4 MET1 [MET2 ...] | --op5 OP5 [OP5 ...] | --op6 OP6 OP6 OP6 | --op7 MET1 MET2 MET3]This is a regression I introduced in#105039. I am working on a fix for this.
/cc@encukou (sorry for the regression!)
CPython versions tested on:
3.12, 3.13
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status
Doc issues