| 1 |
#[cfg(any(Py_3_11, all(Py_3_9, not(PyPy))))] |
| 2 |
use crate::PyFrameObject; |
| 3 |
use crate::{PyObject, PyTypeObject, Py_TYPE}; |
| 4 |
#[cfg(Py_3_12)] |
| 5 |
use std::ffi::c_char; |
| 6 |
use std::ffi::c_int; |
| 7 |
use std::ptr::addr_of_mut; |
| 8 |
|
| 9 |
|
| 10 |
#[cfg(all(Py_3_11, not(PyPy)))] |
| 11 |
opaque_struct!(pub _PyInterpreterFrame); |
| 12 |
|
| 13 |
#[cfg_attr(windows, link(name = "pythonXY"))] |
| 14 |
extern "C" { |
| 15 |
pub static mut PyFrame_Type: PyTypeObject; |
| 16 |
|
| 17 |
#[cfg(Py_3_13)] |
| 18 |
pub static mut PyFrameLocalsProxy_Type: PyTypeObject; |
| 19 |
} |
| 20 |
|
| 21 |
#[inline] |
| 22 |
pub unsafe fn PyFrame_Check(op: *mut PyObject) -> c_int { |
| 23 |
(Py_TYPE(op) == addr_of_mut!(PyFrame_Type)) as c_int |
| 24 |
} |
| 25 |
|
| 26 |
#[cfg(Py_3_13)] |
| 27 |
#[inline] |
| 28 |
pub unsafe fn PyFrameLocalsProxy_Check(op: *mut PyObject) -> c_int { |
| 29 |
(Py_TYPE(op) == addr_of_mut!(PyFrameLocalsProxy_Type)) as c_int |
| 30 |
} |
| 31 |
|
| 32 |
extern "C" { |
| 33 |
#[cfg(all(Py_3_9, not(PyPy)))] |
| 34 |
pub fn PyFrame_GetBack(frame: *mut PyFrameObject) -> *mut PyFrameObject; |
| 35 |
|
| 36 |
#[cfg(Py_3_11)] |
| 37 |
pub fn PyFrame_GetLocals(frame: *mut PyFrameObject) -> *mut PyObject; |
| 38 |
|
| 39 |
#[cfg(Py_3_11)] |
| 40 |
pub fn PyFrame_GetGlobals(frame: *mut PyFrameObject) -> *mut PyObject; |
| 41 |
|
| 42 |
#[cfg(Py_3_11)] |
| 43 |
pub fn PyFrame_GetBuiltins(frame: *mut PyFrameObject) -> *mut PyObject; |
| 44 |
|
| 45 |
#[cfg(Py_3_11)] |
| 46 |
pub fn PyFrame_GetGenerator(frame: *mut PyFrameObject) -> *mut PyObject; |
| 47 |
|
| 48 |
#[cfg(Py_3_11)] |
| 49 |
pub fn PyFrame_GetLasti(frame: *mut PyFrameObject) -> c_int; |
| 50 |
|
| 51 |
#[cfg(Py_3_12)] |
| 52 |
pub fn PyFrame_GetVar(frame: *mut PyFrameObject, name: *mut PyObject) -> *mut PyObject; |
| 53 |
|
| 54 |
#[cfg(Py_3_12)] |
| 55 |
pub fn PyFrame_GetVarString(frame: *mut PyFrameObject, name: *mut c_char) -> *mut PyObject; |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
} |