1use crate::{PyInterpreterState, PyObject};
2#[cfg(not(PyPy))]
3use std::os::raw::c_uchar;
4use std::os::raw::{c_char, c_int};
5
6// skipped PyInit__imp
7
8extern "C" {
9 pub fn _PyImport_IsInitialized(state: *mut PyInterpreterState) -> c_int;
10 // skipped _PyImport_GetModuleId
11 pub fn _PyImport_SetModule(name: *mut PyObject, module: *mut PyObject) -> c_int;
12 pub fn _PyImport_SetModuleString(name: *const c_char, module: *mut PyObject) -> c_int;
13 pub fn _PyImport_AcquireLock();
14 pub fn _PyImport_ReleaseLock() -> c_int;
15 #[cfg(not(Py_3_9))]
16 pub fn _PyImport_FindBuiltin(name: *const c_char, modules: *mut PyObject) -> *mut PyObject;
17 #[cfg(not(Py_3_11))]
18 pub fn _PyImport_FindExtensionObject(a: *mut PyObject, b: *mut PyObject) -> *mut PyObject;
19 pub fn _PyImport_FixupBuiltin(
20 module: *mut PyObject,
21 name: *const c_char,
22 modules: *mut PyObject,
23 ) -> c_int;
24 pub fn _PyImport_FixupExtensionObject(
25 a: *mut PyObject,
26 b: *mut PyObject,
27 c: *mut PyObject,
28 d: *mut PyObject,
29 ) -> c_int;
30}
31
32#[cfg(not(PyPy))]
33#[repr(C)]
34#[derive(Copy, Clone)]
35pub struct _inittab {
36 pub name: *const c_char,
37 pub initfunc: Option<unsafe extern "C" fn() -> *mut PyObject>,
38}
39
40#[cfg_attr(windows, link(name = "pythonXY"))]
41extern "C" {
42 #[cfg(not(PyPy))]
43 pub static mut PyImport_Inittab: *mut _inittab;
44}
45
46extern "C" {
47 #[cfg(not(PyPy))]
48 pub fn PyImport_ExtendInittab(newtab: *mut _inittab) -> c_int;
49}
50
51#[cfg(not(PyPy))]
52#[repr(C)]
53#[derive(Copy, Clone)]
54pub struct _frozen {
55 pub name: *const c_char,
56 pub code: *const c_uchar,
57 pub size: c_int,
58 #[cfg(Py_3_11)]
59 pub is_package: c_int,
60 #[cfg(Py_3_11)]
61 pub get_code: Option<unsafe extern "C" fn() -> *mut PyObject>,
62}
63
64#[cfg_attr(windows, link(name = "pythonXY"))]
65extern "C" {
66 #[cfg(not(PyPy))]
67 pub static mut PyImport_FrozenModules: *const _frozen;
68 #[cfg(all(not(PyPy), Py_3_11))]
69 pub static mut _PyImport_FrozenBootstrap: *const _frozen;
70 #[cfg(all(not(PyPy), Py_3_11))]
71 pub static mut _PyImport_FrozenStdlib: *const _frozen;
72 #[cfg(all(not(PyPy), Py_3_11))]
73 pub static mut _PyImport_FrozenTest: *const _frozen;
74}
75