2001-01-25 20:04:14 +00:00
|
|
|
/* Cell object interface */
|
2021-10-15 02:39:58 +02:00
|
|
|
|
2010-12-03 20:14:31 +00:00
|
|
|
#ifndef Py_LIMITED_API
|
2001-01-25 20:04:14 +00:00
|
|
|
#ifndef Py_CELLOBJECT_H
|
|
|
|
|
#define Py_CELLOBJECT_H
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2017-11-28 17:56:10 +02:00
|
|
|
PyObject_HEAD
|
2021-10-15 02:39:58 +02:00
|
|
|
/* Content of the cell or NULL when empty */
|
|
|
|
|
PyObject *ob_ref;
|
2001-01-25 20:04:14 +00:00
|
|
|
} PyCellObject;
|
|
|
|
|
|
2002-08-12 07:21:58 +00:00
|
|
|
PyAPI_DATA(PyTypeObject) PyCell_Type;
|
2001-01-25 20:04:14 +00:00
|
|
|
|
2022-06-16 13:49:43 +02:00
|
|
|
#define PyCell_Check(op) Py_IS_TYPE((op), &PyCell_Type)
|
2001-01-25 20:04:14 +00:00
|
|
|
|
2002-08-12 07:21:58 +00:00
|
|
|
PyAPI_FUNC(PyObject *) PyCell_New(PyObject *);
|
|
|
|
|
PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *);
|
|
|
|
|
PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *);
|
2001-01-25 20:04:14 +00:00
|
|
|
|
2022-05-11 23:24:48 +02:00
|
|
|
static inline PyObject* PyCell_GET(PyObject *op) {
|
2022-05-15 11:19:52 +02:00
|
|
|
PyCellObject *cell;
|
2022-05-11 23:24:48 +02:00
|
|
|
assert(PyCell_Check(op));
|
2022-05-15 11:19:52 +02:00
|
|
|
cell = _Py_CAST(PyCellObject*, op);
|
2022-05-11 23:24:48 +02:00
|
|
|
return cell->ob_ref;
|
|
|
|
|
}
|
2022-06-13 20:09:40 +02:00
|
|
|
#define PyCell_GET(op) PyCell_GET(_PyObject_CAST(op))
|
2022-05-11 23:24:48 +02:00
|
|
|
|
|
|
|
|
static inline void PyCell_SET(PyObject *op, PyObject *value) {
|
2022-05-15 11:19:52 +02:00
|
|
|
PyCellObject *cell;
|
2022-05-11 23:24:48 +02:00
|
|
|
assert(PyCell_Check(op));
|
2022-05-15 11:19:52 +02:00
|
|
|
cell = _Py_CAST(PyCellObject*, op);
|
2022-05-11 23:24:48 +02:00
|
|
|
cell->ob_ref = value;
|
|
|
|
|
}
|
2022-06-13 20:09:40 +02:00
|
|
|
#define PyCell_SET(op, value) PyCell_SET(_PyObject_CAST(op), (value))
|
2001-01-25 20:04:14 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif /* !Py_TUPLEOBJECT_H */
|
2010-12-03 20:14:31 +00:00
|
|
|
#endif /* Py_LIMITED_API */
|