Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
cellobject.h51 linesDownload Raw Back to cpython
1/* Cell object interface */2 3#ifndef Py_LIMITED_API4#ifndef Py_CELLOBJECT_H5#define Py_CELLOBJECT_H6#ifdef __cplusplus7extern "C" {8#endif9 10typedef struct {11    PyObject_HEAD12    /* Content of the cell or NULL when empty */13    PyObject *ob_ref;14} PyCellObject;15 16PyAPI_DATA(PyTypeObject) PyCell_Type;17 18#define PyCell_Check(op) Py_IS_TYPE((op), &PyCell_Type)19 20PyAPI_FUNC(PyObject *) PyCell_New(PyObject *);21PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *);22PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *);23 24static inline PyObject* PyCell_GET(PyObject *op) {25    PyObject *res;26    PyCellObject *cell;27    assert(PyCell_Check(op));28    cell = _Py_CAST(PyCellObject*, op);29    Py_BEGIN_CRITICAL_SECTION(cell);30    res = cell->ob_ref;31    Py_END_CRITICAL_SECTION();32    return res;33}34#define PyCell_GET(op) PyCell_GET(_PyObject_CAST(op))35 36static inline void PyCell_SET(PyObject *op, PyObject *value) {37    PyCellObject *cell;38    assert(PyCell_Check(op));39    cell = _Py_CAST(PyCellObject*, op);40    Py_BEGIN_CRITICAL_SECTION(cell);41    cell->ob_ref = value;42    Py_END_CRITICAL_SECTION();43}44#define PyCell_SET(op, value) PyCell_SET(_PyObject_CAST(op), (value))45 46#ifdef __cplusplus47}48#endif49#endif /* !Py_TUPLEOBJECT_H */50#endif /* Py_LIMITED_API */51 
codekingpro/portable-devtools · Team Ai