-
Notifications
You must be signed in to change notification settings - Fork 678
/
genobject.rs
100 lines (83 loc) · 2.67 KB
/
genobject.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
use crate::ffi::object::*;
use crate::ffi::pyport::Py_ssize_t;
use crate::ffi::PyFrameObject;
use std::os::raw::c_int;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PyGenObject {
#[cfg(py_sys_config = "Py_TRACE_REFS")]
pub _ob_next: *mut PyObject,
#[cfg(py_sys_config = "Py_TRACE_REFS")]
pub _ob_prev: *mut PyObject,
pub ob_refcnt: Py_ssize_t,
pub ob_type: *mut PyTypeObject,
pub gi_frame: *mut PyFrameObject,
pub gi_running: c_int,
pub gi_code: *mut PyObject,
pub gi_weakreflist: *mut PyObject,
}
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
pub static mut PyGen_Type: PyTypeObject;
}
#[inline]
pub unsafe fn PyGen_Check(op: *mut PyObject) -> c_int {
PyObject_TypeCheck(op, &mut PyGen_Type)
}
#[inline]
pub unsafe fn PyGen_CheckExact(op: *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyGen_Type) as c_int
}
extern "C" {
pub fn PyGen_New(frame: *mut PyFrameObject) -> *mut PyObject;
// skipped PyGen_New
// skipped PyGen_NewWithQualName
// skipped _PyGen_SetStopIterationValue
// skipped _PyGen_FetchStopIterationValue
// skipped _PyGen_yf
// skipped _PyGen_Finalize
#[cfg(not(Py_3_9))]
#[deprecated(note = "This function was never documented in the Python API.")]
pub fn PyGen_NeedsFinalizing(op: *mut PyGenObject) -> c_int;
}
// skipped PyCoroObject
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
pub static mut PyCoro_Type: PyTypeObject;
pub static mut _PyCoroWrapper_Type: PyTypeObject;
}
#[deprecated(since = "0.14.0", note = "use PyCoro_CheckExact instead")]
#[inline]
pub unsafe fn PyCoro_Check(op: *mut PyObject) -> c_int {
PyObject_TypeCheck(op, &mut PyCoro_Type)
}
#[inline]
pub unsafe fn PyCoro_CheckExact(op: *mut PyObject) -> c_int {
PyObject_TypeCheck(op, &mut PyCoro_Type)
}
#[deprecated(since = "0.14.0", note = "not in Python API")]
#[inline]
pub unsafe fn PyCoroWrapper_Check(op: *mut PyObject) -> c_int {
PyObject_TypeCheck(op, &mut _PyCoroWrapper_Type)
}
// skipped _PyCoro_GetAwaitableIter
// skipped PyCoro_New
// skipped PyAsyncGenObject
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
pub static mut PyAsyncGen_Type: PyTypeObject;
// skipped _PyAsyncGenASend_Type
// skipped _PyAsyncGenWrappedValue_Type
// skipped _PyAsyncGenAThrow_Type
}
// skipped PyAsyncGen_New
#[deprecated(since = "0.14.0", note = "use PyCoro_CheckExact instead")]
#[inline]
pub unsafe fn PyAsyncGen_Check(op: *mut PyObject) -> c_int {
PyObject_TypeCheck(op, &mut PyAsyncGen_Type)
}
#[inline]
pub unsafe fn PyAsyncGen_CheckExact(op: *mut PyObject) -> c_int {
PyObject_TypeCheck(op, &mut PyAsyncGen_Type)
}
// skipped _PyAsyncGenValueWrapperNew