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

mutually exclusive group w/ all parameters argparse.SUPPRESS'd causes an assert #98666

Closed
Labels
stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error
@kenyee

Description

@kenyee

Bug report

state_group=parser.add_mutually_exclusive_group()state_group.add_argument('--param1',nargs='?',const='default',metavar='NAME',help=SUPPRESS)state_group.add_argument('--param2',nargs='?',const='default',metavar='NAME',help=SUPPRESS)

will cause an assert in
assert ' '.join(opt_parts) == opt_usage
of argparse.py

because the empty group [] is converted into two spaces
e.g.
[group1] [] [group 2]
gets converted to this by theopt_usage = format(optionals, groups) code above the assert:
[group1] [group 2]
and the two spaces don't match the single space of the assert

Your environment

  • CPython versions tested on: 3.10.4
  • Operating system and architecture: OSX, arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-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