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

GH-140638: Add a GC `"duration"` stat by brandtbucher · Pull Request #141720 · python/cpython · GitHub

/ cpython Public

GH-140638: Add a GC "duration" stat - #141720

Merged
brandtbucher merged 5 commits into
python:mainfrom
brandtbucher:gc-duration
Nov 19, 2025
Merged

GH-140638: Add a GC "duration" stat#141720
brandtbucher merged 5 commits into
python:mainfrom
brandtbucher:gc-duration

Conversation

brandtbucher commented Nov 18, 2025
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

This adds a useful "duration" stat to gc.get_stats and gc.callbacks. It also fixes an issue where the existing timer could be used uninitialized if the GC's debug flags are set during a collection.


📚 Documentation preview 📚: https://cpython-previews--141720.org.readthedocs.build/

brandtbucher self-assigned this Nov 18, 2025
brandtbucher added type-feature A feature request or enhancement interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Nov 18, 2025
Comment thread Doc/library/gc.rst
* ``uncollectable`` is the total number of objects which were found
to be uncollectable (and were therefore moved to the :data:`garbage`
list) inside this generation.
list) inside this generation;

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
Suggested change
list) inside this generation;
list) inside this generation.

Copy link
Copy Markdown
Member Author

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

I just did this for consistency with the above points, haha.

Comment thread Python/gc_free_threading.c Outdated
@@ -1928,7 +1928,8 @@ invoke_gc_callback(PyThreadState *tstate, const char *phase,
info = Py_BuildValue("{sisnsn}",

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

You need to change this line to

Suggested change
info = Py_BuildValue("{sisnsn}",
info = Py_BuildValue("{sisnsnsd}",

no?

Copy link
Copy Markdown
Member Author

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

Nice catch, thanks. Annoying that it just ignores trailing args like that.

pablogsal 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 I left some comments

This comment was marked as spam.

brandtbucher merged commit 598d4c6 into python:main Nov 19, 2025
46 checks passed
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
ashm-dev pushed a commit to ashm-dev/cpython that referenced this pull request Dec 8, 2025
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

interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL