• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Cell object interface */
2 
3 #ifndef Py_LIMITED_API
4 #ifndef Py_CELLOBJECT_H
5 #define Py_CELLOBJECT_H
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 typedef struct {
11     PyObject_HEAD
12     /* Content of the cell or NULL when empty */
13     PyObject *ob_ref;
14 } PyCellObject;
15 
16 PyAPI_DATA(PyTypeObject) PyCell_Type;
17 
18 #define PyCell_Check(op) Py_IS_TYPE(op, &PyCell_Type)
19 
20 PyAPI_FUNC(PyObject *) PyCell_New(PyObject *);
21 PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *);
22 PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *);
23 
24 #define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref)
25 #define PyCell_SET(op, v) _Py_RVALUE(((PyCellObject *)(op))->ob_ref = (v))
26 
27 #ifdef __cplusplus
28 }
29 #endif
30 #endif /* !Py_TUPLEOBJECT_H */
31 #endif /* Py_LIMITED_API */
32