Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Python 3.11 native sampling #635

Merged
merged 5 commits into from
Nov 17, 2023
Merged

Conversation

krfricke
Copy link
Contributor

In Python 3.11, merging native frames works a bit differently. We have to detect if a frame is an "entry frame". Once we hit a native frame that corresponds to python, we need to keep merging python frames until we hit the entry frame.

pystack does it very similarly: https://sourcegraph.com/github.com/bloomberg/pystack/-/blob/src/pystack/_pystack/pyframe.cpp?L73-104

Confirmed this works for me in a "sandwiched" environment, where Python calls Rust, which calls Python again, as well as the simple example from #634.

Closes #634, #617, presumably also #558

Copy link
Owner

@benfred benfred left a comment

Choose a reason for hiding this comment

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

thanks for diving into this and coming up with the fix - nice work!

The change looks good to me

I've created a follow up issue here to track adding tests for the native sampling to CI #640 -

@benfred benfred merged commit 2f8cfdd into benfred:master Nov 17, 2023
182 checks passed
@krfricke krfricke deleted the py311-is-entry branch November 17, 2023 21:27
@njsmith njsmith mentioned this pull request Dec 16, 2023
@benfred benfred added the bug Something isn't working label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python 3.11 --native profiling fails because of bpo-45256
2 participants