GeezerVison is showing github.com — Colorize `timeit` error traceback · Issue #139374 · python/cpython
Colorize timeit error traceback #139374
Description
Feature or enhancement
Proposal:
./python.exe -m timeit '1/0'
maybe better
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
Activity
changed the title
[-]timeit when raise error the traceback not color[/-] [+]timeit: add color to traceback[/+] on Sep 27, 2025changed the title
[-]timeit: add color to traceback[/-] [+]Colorize error traceback in `timeit`[/+] on Sep 27, 2025changed the title
[-]Colorize error traceback in `timeit`[/-] [+]Colorize `timeit` error traceback[/+] on Sep 27, 2025mpkocher commented on Sep 28, 2025
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.
added a commit that references this issue
on Sep 28, 2025gh-139374: colorize traceback when using `timeit` command-line interf…
picnixz commented on Sep 28, 2025
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
mpkocher commented on Sep 28, 2025
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.
picnixz commented on Sep 28, 2025
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
Metadata
Metadata
Development
No branches or pull requestsIssue actions