GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Colorize `timeit` error traceback · Issue #139374 · python/cpython

Colorize timeit error traceback #139374

New issue
Copy link
New issue
Copy link
Closed
Closed
Colorize timeit error traceback#139374
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

Description

@yihong0618
yihong0618
opened on Sep 27, 2025
Issue body actions

Feature or enhancement

Proposal:

./python.exe -m timeit '1/0'
Image

maybe better

Image

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

  • gh-139374: colorize timeit error traceback #139375

Activity

  1. yihong0618
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Sep 27, 2025
  2. StanFromIreland
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Sep 27, 2025
  3. StanFromIreland
    changed the title [-]timeit when raise error the traceback not color[/-] [+]timeit: add color to traceback[/+] on Sep 27, 2025
  4. picnixz
    changed the title [-]timeit: add color to traceback[/-] [+]Colorize error traceback in `timeit`[/+] on Sep 27, 2025
  5. picnixz
    changed the title [-]Colorize error traceback in `timeit`[/-] [+]Colorize `timeit` error traceback[/+] on Sep 27, 2025
  6. mpkocher commented on Sep 28, 2025

    @mpkocher
    mpkocher
    on Sep 28, 2025
    Contributor
    More actions

    This would be creating an inconsistency with the tool.

    The command line interface doesn't support color (because it's using getopt). It's a bit odd if there isn't parity between the out and err cases.

  7. picnixz
    added a commit that references this issue on Sep 28, 2025

    gh-139374: colorize traceback when using `timeit` command-line interf…

    e18dda9
  8. picnixz commented on Sep 28, 2025

    @picnixz
    picnixz
    on Sep 28, 2025
    Member
    More actions

    This inconsistency already exists for python itself. For instance python3.14 -c 'import ok' shows a colored traceback while python --help doesn't. I don't think it's a real issue here.

    Reacted by Hugo van Kemenade
  9. picnixz
    closed this as completedon Sep 28, 2025
  10. mpkocher commented on Sep 28, 2025

    @mpkocher
    mpkocher
    on Sep 28, 2025
    Contributor
    More actions

    This inconsistency already exists for python itself. For instance python3.14 -c 'import ok' shows a colored traceback while python --help doesn't. I don't think it's a real issue here.

    I'm suggesting that within a single tool, there should be consistency.

  11. picnixz commented on Sep 28, 2025

    @picnixz
    picnixz
    on Sep 28, 2025
    Member
    More actions

    But it is consistent? python displays tracebacks with colors, so it doesn't matter here. python --help doesn't have colors while python -c "some_error" will render the tracaeback with colors.

    For others, only --help could be colorized, but not all CLI tools are actually using argparse. I would say that it's fine to have the help not supporting colors.

    Reacted by Hugo van Kemenade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.