| 1 |
use crate::PyThreadState; |
| 2 |
use crate::{PyFrameObject, PyInterpreterState, PyObject}; |
| 3 |
use std::ffi::c_int; |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
pub type Py_tracefunc = unsafe extern "C" fn( |
| 9 |
obj: *mut PyObject, |
| 10 |
frame: *mut PyFrameObject, |
| 11 |
what: c_int, |
| 12 |
arg: *mut PyObject, |
| 13 |
) -> c_int; |
| 14 |
|
| 15 |
pub const PyTrace_CALL: c_int = 0; |
| 16 |
pub const PyTrace_EXCEPTION: c_int = 1; |
| 17 |
pub const PyTrace_LINE: c_int = 2; |
| 18 |
pub const PyTrace_RETURN: c_int = 3; |
| 19 |
pub const PyTrace_C_CALL: c_int = 4; |
| 20 |
pub const PyTrace_C_EXCEPTION: c_int = 5; |
| 21 |
pub const PyTrace_C_RETURN: c_int = 6; |
| 22 |
pub const PyTrace_OPCODE: c_int = 7; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#[cfg(not(any(PyPy, Py_3_14)))] |
| 32 |
#[repr(C)] |
| 33 |
#[derive(Clone, Copy)] |
| 34 |
pub(crate) struct _PyErr_StackItem { |
| 35 |
#[cfg(not(Py_3_11))] |
| 36 |
exc_type: *mut PyObject, |
| 37 |
exc_value: *mut PyObject, |
| 38 |
#[cfg(not(Py_3_11))] |
| 39 |
exc_traceback: *mut PyObject, |
| 40 |
previous_item: *mut _PyErr_StackItem, |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
extern "C" { |
| 49 |
#[cfg(Py_3_13)] |
| 50 |
pub fn PyThreadState_GetUnchecked() -> *mut PyThreadState; |
| 51 |
|
| 52 |
#[cfg(not(Py_3_13))] |
| 53 |
pub(crate) fn _PyThreadState_UncheckedGet() -> *mut PyThreadState; |
| 54 |
|
| 55 |
#[cfg(Py_3_11)] |
| 56 |
pub fn PyThreadState_EnterTracing(state: *mut PyThreadState); |
| 57 |
#[cfg(Py_3_11)] |
| 58 |
pub fn PyThreadState_LeaveTracing(state: *mut PyThreadState); |
| 59 |
|
| 60 |
#[cfg_attr(PyPy, link_name = "PyPyGILState_Check")] |
| 61 |
pub fn PyGILState_Check() -> c_int; |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
#[cfg(not(PyPy))] |
| 69 |
pub fn PyInterpreterState_Main() -> *mut PyInterpreterState; |
| 70 |
#[cfg_attr(PyPy, link_name = "PyPyInterpreterState_Head")] |
| 71 |
pub fn PyInterpreterState_Head() -> *mut PyInterpreterState; |
| 72 |
#[cfg_attr(PyPy, link_name = "PyPyInterpreterState_Next")] |
| 73 |
pub fn PyInterpreterState_Next(interp: *mut PyInterpreterState) -> *mut PyInterpreterState; |
| 74 |
#[cfg(not(PyPy))] |
| 75 |
pub fn PyInterpreterState_ThreadHead(interp: *mut PyInterpreterState) -> *mut PyThreadState; |
| 76 |
#[cfg(not(PyPy))] |
| 77 |
pub fn PyThreadState_Next(tstate: *mut PyThreadState) -> *mut PyThreadState; |
| 78 |
|
| 79 |
#[cfg_attr(PyPy, link_name = "PyPyThreadState_DeleteCurrent")] |
| 80 |
pub fn PyThreadState_DeleteCurrent(); |
| 81 |
} |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|