1use libc::{c_char, c_int, c_void};
2
3use crate::object::PyObject;
4use crate::pystate::PyThreadState;
5
6#[cfg_attr(windows, link(name = "pythonXY"))]
7extern "C" {
8 #[deprecated(since = "0.5.2", note = "Deprecated since Python 3.9")]
9 pub fn PyEval_CallObjectWithKeywords(
10 callable: *mut PyObject,
11 obj: *mut PyObject,
12 kwargs: *mut PyObject,
13 ) -> *mut PyObject;
14}
15
16#[inline]
17#[deprecated(since = "0.5.2", note = "Deprecated since Python 3.9")]
18pub unsafe fn PyEval_CallObject(callable: *mut PyObject, arg: *mut PyObject) -> *mut PyObject {
19 #[allow(deprecated)]
20 PyEval_CallObjectWithKeywords(callable, arg, core::ptr::null_mut())
21}
22
23#[cfg_attr(windows, link(name = "pythonXY"))]
24extern "C" {
25 #[deprecated(since = "0.5.2", note = "Deprecated since Python 3.9")]
26 pub fn PyEval_CallFunction(
27 callable: *mut PyObject,
28 format: *const c_char,
29 ...
30 ) -> *mut PyObject;
31 #[deprecated(since = "0.5.2", note = "Deprecated since Python 3.9")]
32 pub fn PyEval_CallMethod(
33 obj: *mut PyObject,
34 name: *const c_char,
35 format: *const c_char,
36 ...
37 ) -> *mut PyObject;
38 pub fn PyEval_GetBuiltins() -> *mut PyObject;
39 pub fn PyEval_GetGlobals() -> *mut PyObject;
40 pub fn PyEval_GetLocals() -> *mut PyObject;
41 pub fn PyEval_GetFrame() -> *mut crate::PyFrameObject;
42 pub fn Py_AddPendingCall(
43 func: Option<extern "C" fn(arg1: *mut c_void) -> c_int>,
44 arg: *mut c_void,
45 ) -> c_int;
46 pub fn Py_MakePendingCalls() -> c_int;
47 pub fn Py_SetRecursionLimit(arg1: c_int) -> ();
48 pub fn Py_GetRecursionLimit() -> c_int;
49
50 ignore! {
51 fn _Py_CheckRecursiveCall(_where: *mut c_char) -> c_int;
52 static mut _Py_CheckRecursionLimit: c_int;
53 }
54
55 #[cfg(Py_3_9)]
56 pub fn Py_EnterRecursiveCall(_where: *const c_char) -> c_int;
57 #[cfg(Py_3_9)]
58 pub fn Py_LeaveRecursiveCall() -> c_void;
59}
60
61#[cfg_attr(windows, link(name = "pythonXY"))]
64extern "C" {
65 pub fn PyEval_GetFuncName(arg1: *mut PyObject) -> *const c_char;
66 pub fn PyEval_GetFuncDesc(arg1: *mut PyObject) -> *const c_char;
67 #[cfg(not(Py_3_7))]
68 pub fn PyEval_GetCallStats(arg1: *mut PyObject) -> *mut PyObject;
69 pub fn PyEval_EvalFrame(arg1: *mut crate::PyFrameObject) -> *mut PyObject;
70 pub fn PyEval_EvalFrameEx(f: *mut crate::PyFrameObject, exc: c_int) -> *mut PyObject;
71 pub fn PyEval_SaveThread() -> *mut PyThreadState;
72 pub fn PyEval_RestoreThread(arg1: *mut PyThreadState) -> ();
73}
74
75#[cfg(any(Py_3_7, py_sys_config = "WITH_THREAD"))]
76#[cfg_attr(windows, link(name = "pythonXY"))]
77extern "C" {
78 pub fn PyEval_ThreadsInitialized() -> c_int;
79 pub fn PyEval_InitThreads() -> ();
80 #[deprecated(
81 since = "0.2.1",
82 note = "Deprecated since Python 3.2: This function does not update the current thread state. Please use PyEval_RestoreThread() or PyEval_AcquireThread() instead."
83 )]
84 pub fn PyEval_AcquireLock() -> ();
85 #[deprecated(
86 since = "0.2.1",
87 note = "Deprecated since Python 3.2: This function does not update the current thread state. Please use PyEval_RestoreThread() or PyEval_AcquireThread() instead."
88 )]
89 pub fn PyEval_ReleaseLock() -> ();
90 pub fn PyEval_AcquireThread(tstate: *mut PyThreadState) -> ();
91 pub fn PyEval_ReleaseThread(tstate: *mut PyThreadState) -> ();
92 #[cfg(not(Py_3_8))]
93 pub fn PyEval_ReInitThreads() -> ();
94}