1 | use crate::{PyGetSetDef, PyMethodDef, PyObject, PyTypeObject}; |
2 | use std::os::raw::{c_char, c_int, c_void}; |
3 | |
4 | pub type wrapperfunc = Option< |
5 | unsafe extern "C" fn( |
6 | slf: *mut PyObject, |
7 | args: *mut PyObject, |
8 | wrapped: *mut c_void, |
9 | ) -> *mut PyObject, |
10 | >; |
11 | |
12 | pub type wrapperfunc_kwds = Option< |
13 | unsafe extern "C" fn( |
14 | slf: *mut PyObject, |
15 | args: *mut PyObject, |
16 | wrapped: *mut c_void, |
17 | kwds: *mut PyObject, |
18 | ) -> *mut PyObject, |
19 | >; |
20 | |
21 | #[repr (C)] |
22 | pub struct wrapperbase { |
23 | pub name: *const c_char, |
24 | pub offset: c_int, |
25 | pub function: *mut c_void, |
26 | pub wrapper: wrapperfunc, |
27 | pub doc: *const c_char, |
28 | pub flags: c_int, |
29 | pub name_strobj: *mut PyObject, |
30 | } |
31 | |
32 | pub const PyWrapperFlag_KEYWORDS: c_int = 1; |
33 | |
34 | #[repr (C)] |
35 | pub struct PyDescrObject { |
36 | pub ob_base: PyObject, |
37 | pub d_type: *mut PyTypeObject, |
38 | pub d_name: *mut PyObject, |
39 | pub d_qualname: *mut PyObject, |
40 | } |
41 | |
42 | // skipped non-limited PyDescr_TYPE |
43 | // skipped non-limited PyDescr_NAME |
44 | |
45 | #[repr (C)] |
46 | pub struct PyMethodDescrObject { |
47 | pub d_common: PyDescrObject, |
48 | pub d_method: *mut PyMethodDef, |
49 | #[cfg (all(not(PyPy), Py_3_8))] |
50 | pub vectorcall: Option<crate::vectorcallfunc>, |
51 | } |
52 | |
53 | #[repr (C)] |
54 | pub struct PyMemberDescrObject { |
55 | pub d_common: PyDescrObject, |
56 | pub d_member: *mut PyGetSetDef, |
57 | } |
58 | |
59 | #[repr (C)] |
60 | pub struct PyGetSetDescrObject { |
61 | pub d_common: PyDescrObject, |
62 | pub d_getset: *mut PyGetSetDef, |
63 | } |
64 | |
65 | #[repr (C)] |
66 | pub struct PyWrapperDescrObject { |
67 | pub d_common: PyDescrObject, |
68 | pub d_base: *mut wrapperbase, |
69 | pub d_wrapped: *mut c_void, |
70 | } |
71 | |
72 | #[cfg_attr (windows, link(name = "pythonXY" ))] |
73 | extern "C" { |
74 | pub static mut _PyMethodWrapper_Type: PyTypeObject; |
75 | } |
76 | |
77 | // skipped non-limited PyDescr_NewWrapper |
78 | // skipped non-limited PyDescr_IsData |
79 | |