From b651502c11adc67fae7728238b22556ed747a7c2 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 28 May 2022 15:47:47 -0400 Subject: [PATCH 1/2] Expose PyFrame_GetCode --- pyo3-ffi/src/pyframe.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyo3-ffi/src/pyframe.rs b/pyo3-ffi/src/pyframe.rs index c58bc1fb..5adaaeb1 100644 --- a/pyo3-ffi/src/pyframe.rs +++ b/pyo3-ffi/src/pyframe.rs @@ -1,3 +1,5 @@ +#[cfg(Py_3_9)] +use crate::PyCodeObject; #[cfg(not(Py_LIMITED_API))] use crate::PyFrameObject; use std::os::raw::c_int; @@ -7,5 +9,6 @@ opaque_struct!(PyFrameObject); extern "C" { pub fn PyFrame_GetLineNumber(f: *mut PyFrameObject) -> c_int; + #[cfg(Py_3_9)] + pub fn PyFrame_GetCode(f: *mut PyFrameObject) -> *mut PyCodeObject; } -// skipped PyFrame_GetCode From 7a7926c0ffaaf11542a88ca80db25a3cac179c17 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 28 May 2022 22:45:50 -0400 Subject: [PATCH 2/2] Update pyframe.rs --- pyo3-ffi/src/pyframe.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyo3-ffi/src/pyframe.rs b/pyo3-ffi/src/pyframe.rs index 5adaaeb1..43a9d1f6 100644 --- a/pyo3-ffi/src/pyframe.rs +++ b/pyo3-ffi/src/pyframe.rs @@ -1,4 +1,4 @@ -#[cfg(Py_3_9)] +#[cfg(any(Py_3_10, all(Py_3_9, not(Py_LIMITED_API))))] use crate::PyCodeObject; #[cfg(not(Py_LIMITED_API))] use crate::PyFrameObject; @@ -9,6 +9,6 @@ opaque_struct!(PyFrameObject); extern "C" { pub fn PyFrame_GetLineNumber(f: *mut PyFrameObject) -> c_int; - #[cfg(Py_3_9)] + #[cfg(any(Py_3_10, all(Py_3_9, not(Py_LIMITED_API))))] pub fn PyFrame_GetCode(f: *mut PyFrameObject) -> *mut PyCodeObject; }