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

Expose PyFrame_GetCode #2406

Merged
merged 2 commits into from May 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion pyo3-ffi/src/pyframe.rs
@@ -1,3 +1,5 @@
#[cfg(any(Py_3_10, all(Py_3_9, not(Py_LIMITED_API))))]
use crate::PyCodeObject;
#[cfg(not(Py_LIMITED_API))]
use crate::PyFrameObject;
use std::os::raw::c_int;
Expand All @@ -7,5 +9,6 @@ opaque_struct!(PyFrameObject);

extern "C" {
pub fn PyFrame_GetLineNumber(f: *mut PyFrameObject) -> c_int;
#[cfg(any(Py_3_10, all(Py_3_9, not(Py_LIMITED_API))))]
pub fn PyFrame_GetCode(f: *mut PyFrameObject) -> *mut PyCodeObject;
Copy link
Member

@messense messense May 29, 2022

Choose a reason for hiding this comment

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

Since it's part of the stable ABI since 3.10, I think we can annotate it with #[cfg(any(Py_3_10, all(Py_3_9, not(Py_LIMITED_API))))]?

https://docs.python.org/3/c-api/reflection.html#c.PyFrame_GetCode

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, done

}
// skipped PyFrame_GetCode