| 1 | #[cfg(any(not(PyPy), Py_3_14))] |
| 2 | use crate::PyObject; |
| 3 | #[cfg(any(not(PyPy), Py_3_14))] |
| 4 | use std::ffi::c_char; |
| 5 | #[cfg(not(PyPy))] |
| 6 | use std::ffi::{c_int, c_uchar}; |
| 7 | |
| 8 | #[cfg(not(PyPy))] |
| 9 | #[repr(C)] |
| 10 | #[derive(Copy, Clone)] |
| 11 | pub struct _inittab { |
| 12 | pub name: *const c_char, |
| 13 | pub initfunc: Option<unsafe extern "C" fn() -> *mut PyObject>, |
| 14 | } |
| 15 | |
| 16 | #[cfg_attr(windows, link(name = "pythonXY"))] |
| 17 | extern "C" { |
| 18 | #[cfg(not(PyPy))] |
| 19 | pub static mut PyImport_Inittab: *mut _inittab; |
| 20 | |
| 21 | #[cfg(not(PyPy))] |
| 22 | pub fn PyImport_ExtendInittab(newtab: *mut _inittab) -> c_int; |
| 23 | } |
| 24 | |
| 25 | #[cfg(not(PyPy))] |
| 26 | #[repr(C)] |
| 27 | #[derive(Copy, Clone)] |
| 28 | pub struct _frozen { |
| 29 | pub name: *const c_char, |
| 30 | pub code: *const c_uchar, |
| 31 | pub size: c_int, |
| 32 | #[cfg(Py_3_11)] |
| 33 | pub is_package: c_int, |
| 34 | #[cfg(all(Py_3_11, not(Py_3_13)))] |
| 35 | pub get_code: Option<unsafe extern "C" fn() -> *mut PyObject>, |
| 36 | } |
| 37 | |
| 38 | #[cfg_attr(windows, link(name = "pythonXY"))] |
| 39 | extern "C" { |
| 40 | #[cfg(not(PyPy))] |
| 41 | pub static mut PyImport_FrozenModules: *const _frozen; |
| 42 | |
| 43 | #[cfg(Py_3_14)] |
| 44 | pub fn PyImport_ImportModuleAttr( |
| 45 | mod_name: *mut PyObject, |
| 46 | attr_name: *mut PyObject, |
| 47 | ) -> *mut PyObject; |
| 48 | #[cfg(Py_3_14)] |
| 49 | pub fn PyImport_ImportModuleAttrString( |
| 50 | mod_name: *const c_char, |
| 51 | attr_name: *const c_char, |
| 52 | ) -> *mut PyObject; |
| 53 | } |