1use crate::object::PyObject;
2use crate::pystate::PyThreadState;
3use std::os::raw::{c_char, c_int, c_void};
4
5extern "C" {
6 #[cfg_attr(PyPy, link_name = "PyPyEval_EvalCode")]
7 pub fn PyEval_EvalCode(
8 arg1: *mut PyObject,
9 arg2: *mut PyObject,
10 arg3: *mut PyObject,
11 ) -> *mut PyObject;
12
13 pub fn PyEval_EvalCodeEx(
14 co: *mut PyObject,
15 globals: *mut PyObject,
16 locals: *mut PyObject,
17 args: *const *mut PyObject,
18 argc: c_int,
19 kwds: *const *mut PyObject,
20 kwdc: c_int,
21 defs: *const *mut PyObject,
22 defc: c_int,
23 kwdefs: *mut PyObject,
24 closure: *mut PyObject,
25 ) -> *mut PyObject;
26
27 #[cfg_attr(Py_3_9, deprecated(note = "Python 3.9"))]
28 #[cfg_attr(PyPy, link_name = "PyPyEval_CallObjectWithKeywords")]
29 pub fn PyEval_CallObjectWithKeywords(
30 func: *mut PyObject,
31 obj: *mut PyObject,
32 kwargs: *mut PyObject,
33 ) -> *mut PyObject;
34}
35
36#[cfg_attr(Py_3_9, deprecated(note = "Python 3.9"))]
37#[inline]
38pub unsafe fn PyEval_CallObject(func: *mut PyObject, arg: *mut PyObject) -> *mut PyObject {
39 #[allow(deprecated)]
40 PyEval_CallObjectWithKeywords(func, obj:arg, kwargs:std::ptr::null_mut())
41}
42
43extern "C" {
44 #[cfg_attr(Py_3_9, deprecated(note = "Python 3.9"))]
45 #[cfg_attr(PyPy, link_name = "PyPyEval_CallFunction")]
46 pub fn PyEval_CallFunction(obj: *mut PyObject, format: *const c_char, ...) -> *mut PyObject;
47 #[cfg_attr(Py_3_9, deprecated(note = "Python 3.9"))]
48 #[cfg_attr(PyPy, link_name = "PyPyEval_CallMethod")]
49 pub fn PyEval_CallMethod(
50 obj: *mut PyObject,
51 methodname: *const c_char,
52 format: *const c_char,
53 ...
54 ) -> *mut PyObject;
55 #[cfg_attr(PyPy, link_name = "PyPyEval_GetBuiltins")]
56 pub fn PyEval_GetBuiltins() -> *mut PyObject;
57 #[cfg_attr(PyPy, link_name = "PyPyEval_GetGlobals")]
58 pub fn PyEval_GetGlobals() -> *mut PyObject;
59 #[cfg_attr(PyPy, link_name = "PyPyEval_GetLocals")]
60 pub fn PyEval_GetLocals() -> *mut PyObject;
61 pub fn PyEval_GetFrame() -> *mut crate::PyFrameObject;
62 #[cfg_attr(PyPy, link_name = "PyPy_AddPendingCall")]
63 pub fn Py_AddPendingCall(
64 func: Option<extern "C" fn(arg1: *mut c_void) -> c_int>,
65 arg: *mut c_void,
66 ) -> c_int;
67 #[cfg_attr(PyPy, link_name = "PyPy_MakePendingCalls")]
68 pub fn Py_MakePendingCalls() -> c_int;
69 #[cfg_attr(PyPy, link_name = "PyPy_SetRecursionLimit")]
70 pub fn Py_SetRecursionLimit(arg1: c_int);
71 #[cfg_attr(PyPy, link_name = "PyPy_GetRecursionLimit")]
72 pub fn Py_GetRecursionLimit() -> c_int;
73 fn _Py_CheckRecursiveCall(_where: *mut c_char) -> c_int;
74}
75
76extern "C" {
77 #[cfg(Py_3_9)]
78 #[cfg_attr(PyPy, link_name = "PyPy_EnterRecursiveCall")]
79 pub fn Py_EnterRecursiveCall(arg1: *const c_char) -> c_int;
80 #[cfg(Py_3_9)]
81 #[cfg_attr(PyPy, link_name = "PyPy_LeaveRecursiveCall")]
82 pub fn Py_LeaveRecursiveCall();
83}
84
85extern "C" {
86 pub fn PyEval_GetFuncName(arg1: *mut PyObject) -> *const c_char;
87 pub fn PyEval_GetFuncDesc(arg1: *mut PyObject) -> *const c_char;
88 pub fn PyEval_GetCallStats(arg1: *mut PyObject) -> *mut PyObject;
89 pub fn PyEval_EvalFrame(arg1: *mut crate::PyFrameObject) -> *mut PyObject;
90 pub fn PyEval_EvalFrameEx(f: *mut crate::PyFrameObject, exc: c_int) -> *mut PyObject;
91 #[cfg_attr(PyPy, link_name = "PyPyEval_SaveThread")]
92 pub fn PyEval_SaveThread() -> *mut PyThreadState;
93 #[cfg_attr(PyPy, link_name = "PyPyEval_RestoreThread")]
94 pub fn PyEval_RestoreThread(arg1: *mut PyThreadState);
95}
96
97extern "C" {
98 #[cfg_attr(PyPy, link_name = "PyPyEval_ThreadsInitialized")]
99 pub fn PyEval_ThreadsInitialized() -> c_int;
100 #[cfg_attr(PyPy, link_name = "PyPyEval_InitThreads")]
101 pub fn PyEval_InitThreads();
102 pub fn PyEval_AcquireLock();
103 pub fn PyEval_ReleaseLock();
104 #[cfg_attr(PyPy, link_name = "PyPyEval_AcquireThread")]
105 pub fn PyEval_AcquireThread(tstate: *mut PyThreadState);
106 #[cfg_attr(PyPy, link_name = "PyPyEval_ReleaseThread")]
107 pub fn PyEval_ReleaseThread(tstate: *mut PyThreadState);
108 #[cfg(not(Py_3_8))]
109 pub fn PyEval_ReInitThreads();
110}
111
112// skipped Py_BEGIN_ALLOW_THREADS
113// skipped Py_BLOCK_THREADS
114// skipped Py_UNBLOCK_THREADS
115// skipped Py_END_ALLOW_THREADS
116// skipped FVC_MASK
117// skipped FVC_NONE
118// skipped FVC_STR
119// skipped FVC_REPR
120// skipped FVC_ASCII
121// skipped FVS_MASK
122// skipped FVS_HAVE_SPEC
123