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

pyo3-ffi: expose PyThreadState_GetFrame and PyFrame_GetBack #4866

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yoav-orca
Copy link

I'm working on writing (another) profiler in rust for python.
This PR exposes the functions required for unwinding the stack.

@@ -66,6 +67,12 @@ extern "C" {
// skipped non-limited / 3.9 PyThreadState_GetFrame
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment should be removed I suppose.

@yoav-orca yoav-orca force-pushed the expose_getframe_and_getcode branch 2 times, most recently from 533d05c to 2696147 Compare January 19, 2025 17:39
@yoav-orca yoav-orca force-pushed the expose_getframe_and_getcode branch from 2696147 to a20f6a8 Compare January 19, 2025 18:49
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Thanks

Comment on lines 91 to +93
// skipped _PyFrame_DebugMallocStats
// skipped PyFrame_GetBack
#[cfg(all(Py_3_9, not(PyPy)))]
pub fn PyFrame_GetBack(f: *mut PyFrameObject) -> *mut PyFrameObject;
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this function was moved to pyframe.h in upstream CPython. We should log a follow up to sync this sometime.

@davidhewitt davidhewitt added this pull request to the merge queue Jan 24, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 24, 2025
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.

3 participants