File indexing completed on 2025-01-30 10:18:03
0001
0002
0003 #ifndef Py_LIMITED_API
0004 #ifndef Py_CELLOBJECT_H
0005 #define Py_CELLOBJECT_H
0006 #ifdef __cplusplus
0007 extern "C" {
0008 #endif
0009
0010 typedef struct {
0011 PyObject_HEAD
0012
0013 PyObject *ob_ref;
0014 } PyCellObject;
0015
0016 PyAPI_DATA(PyTypeObject) PyCell_Type;
0017
0018 #define PyCell_Check(op) Py_IS_TYPE((op), &PyCell_Type)
0019
0020 PyAPI_FUNC(PyObject *) PyCell_New(PyObject *);
0021 PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *);
0022 PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *);
0023
0024 static inline PyObject* PyCell_GET(PyObject *op) {
0025 PyCellObject *cell;
0026 assert(PyCell_Check(op));
0027 cell = _Py_CAST(PyCellObject*, op);
0028 return cell->ob_ref;
0029 }
0030 #define PyCell_GET(op) PyCell_GET(_PyObject_CAST(op))
0031
0032 static inline void PyCell_SET(PyObject *op, PyObject *value) {
0033 PyCellObject *cell;
0034 assert(PyCell_Check(op));
0035 cell = _Py_CAST(PyCellObject*, op);
0036 cell->ob_ref = value;
0037 }
0038 #define PyCell_SET(op, value) PyCell_SET(_PyObject_CAST(op), (value))
0039
0040 #ifdef __cplusplus
0041 }
0042 #endif
0043 #endif
0044 #endif