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

Appearance settings

argparse indentation overshoots due to colors #139736

Copy link
Copy link
@9001

Description

@9001
Issue body actions

Bug report

Bug description:

As of 3.14, argparse --help accidentally includes the ansi-escapes when calculating the length of the invocations, resulting in excessive margins between options and their helptext. Effectively, the indentation will always be 24 (max_help_position).

import argparse
argparse.ArgumentParser().print_help()

in 3.14, this produces:

options:
  -h, --help            show this help message and exit

in previous versions, it produces:

options:
  -h, --help  show this help message and exit

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixesbugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    No fields configured for issues without a type.

    Projects

    Status
    Doc issues
    Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.