FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-139374: colorize `timeit` error traceback by yihong0618 · Pull Request #139375 · python/cpython · GitHub

Repository navigation

gh-139374: colorize timeit error traceback - #139375

Merged
picnixz merged 17 commits into
python:mainfrom
yihong0618:hy/color_the_timeit_traceback
Sep 28, 2025
Merged

picnixz merged 17 commits into
python:mainfrom
yihong0618:hy/color_the_timeit_traceback

Conversation

yihong0618 commented Sep 27, 2025 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
yihong0618 marked this pull request as ready for review September 27, 2025 00:27
yihong0618 marked this pull request as draft September 27, 2025 00:40
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Comment thread Lib/test/test_timeit.py Outdated
picnixz changed the title gh-139374: make timeit traceback can with color gh-139374: colorize timeit error traceback Sep 27, 2025
yihong0618 and others added 2 commits September 27, 2025 16:39
…fh-dl.rst

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
yihong0618 marked this pull request as ready for review September 27, 2025 08:44
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Comment thread Lib/timeit.py Outdated
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
yihong0618 requested a review from hugovk September 27, 2025 11:27

Copy link
Copy Markdown
Contributor

Is this worth writing into what's new in 3.15? Maybe we can do it later

https://github.com/python/cpython/blob/main/Doc/whatsnew/3.14.rst#L97-L101

picnixz commented Sep 27, 2025

Copy link
Copy Markdown
Member

Is this worth writing into what's new in 3.15? Maybe we can do it later

Yes. And we should add it in this PR not in a separate one.

Comment thread Lib/timeit.py Outdated
yihong0618 and others added 2 commits September 28, 2025 09:00
…fh-dl.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Signed-off-by: yihong0618 <zouzou0208@gmail.com>

Copy link
Copy Markdown
Contributor Author

Is this worth writing into what's new in 3.15? Maybe we can do it later

Yes. And we should add it in this PR not in a separate one.

will try to learn how to add it...

StanFromIreland commented Sep 28, 2025 •
edited
Loading

Copy link
Copy Markdown
Member

You can look at existing entries for inspiration, e.g.:

Unraisable exceptions are now highlighted with color by default. This can be controlled by environment variables. (Contributed by Peter Bierma in gh-134170.)

In this case, under "timeit", something along the lines of:

Error tracebacks are now colourised by default. This can be controlled by environment variables. (Contributed by YOU in gh-PRNO.)

Copy link
Copy Markdown
Contributor Author

You can look at existing entries for inspiration, e.g.:

Unraisable exceptions are now highlighted with color by default. This can be controlled by environment variables. (Contributed by Peter Bierma in gh-134170.)

In this case, under "timeit", something along the lines of:

Error tracebacks are now colourised by default. This can be controlled by environment variables. (Contributed by YOU in gh-PRNO.)

Thank you very much!

Comment thread Lib/timeit.py
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Comment thread Lib/timeit.py
Comment thread Lib/timeit.py Outdated
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Comment thread Doc/whatsnew/3.15.rst Outdated
Comment thread Lib/timeit.py
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Comment thread Lib/timeit.py Outdated
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Signed-off-by: yihong0618 <zouzou0208@gmail.com>

picnixz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sorry for my back-and-forth suggestions but it's to ease future maintenance.

Comment thread Lib/timeit.py Outdated
Comment thread Lib/timeit.py Outdated
Comment thread Lib/timeit.py Outdated

Copy link
Copy Markdown
Contributor Author

Sorry for my back-and-forth suggestions but it's to ease future maintenance.

I enjoyed learning, thank you very much for the hint. really, changing now

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Comment thread Doc/whatsnew/3.15.rst Outdated
Comment thread Lib/test/test_timeit.py Outdated
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Comment thread Lib/test/test_timeit.py Outdated
yihong0618 and others added 2 commits September 28, 2025 19:19
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

picnixz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Now this is good. Thanks for the patch!

StanFromIreland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

picnixz enabled auto-merge (squash) September 28, 2025 11:21
picnixz merged commit e18dda9 into python:main Sep 28, 2025
45 checks passed

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 CentOS9 NoGIL Refleaks 3.x (tier-1) has failed when building commit e18dda9.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1610/builds/2134) and take a look at the build logs.
  4. Check if the failure is related to this commit (e18dda9) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1610/builds/2134

Failed tests:

  • test_free_threading

Test leaking resources:

  • test_free_threading: file descriptors

Summary of the results of the build (if available):

==

Click to see traceback logs
remote: Enumerating objects: 15, done.        
remote: Counting objects:   8% (1/12)        
remote: Counting objects:  16% (2/12)        
remote: Counting objects:  25% (3/12)        
remote: Counting objects:  33% (4/12)        
remote: Counting objects:  41% (5/12)        
remote: Counting objects:  50% (6/12)        
remote: Counting objects:  58% (7/12)        
remote: Counting objects:  66% (8/12)        
remote: Counting objects:  75% (9/12)        
remote: Counting objects:  83% (10/12)        
remote: Counting objects:  91% (11/12)        
remote: Counting objects: 100% (12/12)        
remote: Counting objects: 100% (12/12), done.        
remote: Compressing objects:  11% (1/9)        
remote: Compressing objects:  22% (2/9)        
remote: Compressing objects:  33% (3/9)        
remote: Compressing objects:  44% (4/9)        
remote: Compressing objects:  55% (5/9)        
remote: Compressing objects:  66% (6/9)        
remote: Compressing objects:  77% (7/9)        
remote: Compressing objects:  88% (8/9)        
remote: Compressing objects: 100% (9/9)        
remote: Compressing objects: 100% (9/9), done.        
remote: Total 15 (delta 3), reused 3 (delta 3), pack-reused 3 (from 2)        
From https://github.com/python/cpython
 * branch                    main       -> FETCH_HEAD
Note: switching to 'e18dda96c967911fe387ed93c7efe105e7cc1274'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at e18dda96c96 gh-139374: colorize traceback when using `timeit` command-line interface (#139375)
Switched to and reset branch 'main'

configure: WARNING: no system libmpdec found; falling back to pure-Python version for the decimal module

make: *** [Makefile:2487: buildbottest] Error 2

Comment thread Lib/traceback.py
Comment thread Lib/timeit.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL