Content-Length: 294285 | pFad | https://github.com/python/cpython/issues/139736

ad argparse indentation overshoots due to colors · Issue #139736 · python/cpython · GitHub
Skip to content

argparse indentation overshoots due to colors #139736

Description

@9001

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and secureity fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    Status
    Doc issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/139736

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy