Skip to main content

pyo3_ffi/cpython/
cellobject.rs

1use crate::object::*;
2use std::ffi::c_int;
3
4#[cfg(not(any(PyPy, GraalPy)))]
5#[repr(C)]
6pub struct PyCellObject {
7    pub ob_base: PyObject,
8    pub ob_ref: *mut PyObject,
9}
10
11extern_libpython! {
12    pub fn PyCell_New(o: *mut PyObject) -> *mut PyObject;
13    pub fn PyCell_Get(o: *mut PyObject) -> *mut PyObject;
14    pub fn PyCell_Set(o: *mut PyObject, val: *mut PyObject) -> *mut PyObject;
15    pub static mut PyCell_Type: PyTypeObject;
16}
17
18#[inline]
19pub unsafe fn PyCell_Check(op: *mut PyObject) -> c_int {
20    Py_IS_TYPE(op, &raw mut PyCell_Type)
21}
22
23// skipped PyCell_SET
24// skipped PyCell_GET
⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here