python27_sys/
genobject.rs

1use libc::c_int;
2
3use crate::frameobject::PyFrameObject;
4use crate::object::*;
5use crate::pyport::Py_ssize_t;
6
7#[repr(C)]
8#[derive(Copy, Clone)]
9pub struct PyGenObject {
10    #[cfg(py_sys_config = "Py_TRACE_REFS")]
11    pub _ob_next: *mut PyObject,
12    #[cfg(py_sys_config = "Py_TRACE_REFS")]
13    pub _ob_prev: *mut PyObject,
14    pub ob_refcnt: Py_ssize_t,
15    pub ob_type: *mut PyTypeObject,
16    pub gi_frame: *mut PyFrameObject,
17    pub gi_running: c_int,
18    pub gi_code: *mut PyObject,
19    pub gi_weakreflist: *mut PyObject,
20}
21
22#[cfg_attr(windows, link(name = "pythonXY"))]
23extern "C" {
24    pub static mut PyGen_Type: PyTypeObject;
25}
26
27#[inline(always)]
28pub unsafe fn PyGen_Check(op: *mut PyObject) -> c_int {
29    PyObject_TypeCheck(op, &mut PyGen_Type)
30}
31
32#[inline(always)]
33pub unsafe fn PyGen_CheckExact(op: *mut PyObject) -> c_int {
34    (Py_TYPE(op) == &mut PyGen_Type) as c_int
35}
36
37#[cfg_attr(windows, link(name = "pythonXY"))]
38extern "C" {
39    pub fn PyGen_New(frame: *mut PyFrameObject) -> *mut PyObject;
40    pub fn PyGen_NeedsFinalizing(op: *mut PyGenObject) -> c_int;
41}