Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

argparse: usage text of arguments in mutually exclusive groups no longer wraps in Python 3.13 #121151

Closed
Labels
3.13bugs and security fixes3.14bugs and security fixestype-bugAn unexpected behavior, bug, or error
@hamdanal

Description

@hamdanal

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

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixestype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Doc issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp