Skip to content

gh-142927: Hide _sync_coordinator frames from profiler output - #143337

Merged
pablogsal merged 1 commit into
python:mainfrom
pablogsal:hide
Jan 2, 2026
Merged

gh-142927: Hide _sync_coordinator frames from profiler output#143337
pablogsal merged 1 commit into
python:mainfrom
pablogsal:hide

Conversation

@pablogsal

@pablogsalpablogsal commented Jan 1, 2026

Copy link
Copy Markdown
Member

When running scripts via "python -m profiling.sampling run", the internal
_sync_coordinator module appears in stack traces between runpy and user
code. These frames are implementation details that clutter the output and
provide no useful information to users analyzing their program's behavior.

The fix adds a filter_internal_frames function that removes frames from
_sync_coordinator.py anywhere in the call stack. This is applied in both
the base Collector._iter_all_frames method and directly in GeckoCollector
which bypasses the iterator. Tests cover all collector types: pstats,
flamegraph, collapsed stack, and gecko formats.

@bedevere-appbedevere-appBot mentioned this pull request Jan 1, 2026
11 tasks
@pablogsalpablogsal added type-bug An unexpected behavior, bug, or error skip news and removed awaiting core review labels Jan 1, 2026
@pablogsal

Copy link
Copy Markdown
MemberAuthor

@lkollar

When running scripts via "python -m profiling.sampling run", the internal
_sync_coordinator module appears in stack traces between runpy and user
code. These frames are implementation details that clutter the output and
provide no useful information to users analyzing their program's behavior.
The fix adds a filter_internal_frames function that removes frames from
_sync_coordinator.py anywhere in the call stack. This is applied in both
the base Collector._iter_all_frames method and directly in GeckoCollector
which bypasses the iterator. Tests cover all collector types: pstats,
flamegraph, collapsed stack, and gecko formats.
@picnixzpicnixz added awaiting core review and removed type-bug An unexpected behavior, bug, or error labels Jan 1, 2026

@ivonastojanovicivonastojanovic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice! LGTM!

@pablogsal
pablogsal merged commit 09ce592 into python:mainJan 2, 2026
48 checks passed
@pablogsal
pablogsal deleted the hide branch January 2, 2026 12:09
thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@pablogsal@ivonastojanovic@picnixz