Skip to content

Conversation

@pablogsal
Copy link
Member

@pablogsalpablogsal commented Jan 1, 2026

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
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
Copy link
Contributor

@ivonastojanovicivonastojanovic left a comment

Choose a reason for hiding this comment

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

Nice! LGTM!

@pablogsalpablogsal merged commit 09ce592 into python:mainJan 2, 2026
48 checks passed
@pablogsalpablogsal deleted the hide branch January 2, 2026 12:09
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