diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-01-25 20:04:14 +0000 |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-01-25 20:04:14 +0000 |
commit | 7f2a7c65afca247d79d16da2eae73878911423b1 (patch) | |
tree | 68bba343fb416096ce0b40b5fe1924aa534387e6 /Include/cellobject.h | |
parent | 820455949f1f93bec0e3aecb20e35f3668826596 (diff) | |
download | cpython-7f2a7c65afca247d79d16da2eae73878911423b1.tar.gz |
PEP 227 implementation
A cell contains a reference to a single PyObject. It could be
implemented as a mutable, one-element sequence, but the separate type
has less overhead.
Diffstat (limited to 'Include/cellobject.h')
-rw-r--r-- | Include/cellobject.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Include/cellobject.h b/Include/cellobject.h new file mode 100644 index 0000000000..cc4a159e85 --- /dev/null +++ b/Include/cellobject.h @@ -0,0 +1,28 @@ +/* Cell object interface */ + +#ifndef Py_CELLOBJECT_H +#define Py_CELLOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject_VAR_HEAD + PyObject *ob_ref; +} PyCellObject; + +extern DL_IMPORT(PyTypeObject) PyCell_Type; + +#define PyCell_Check(op) ((op)->ob_type == &PyCell_Type) + +extern DL_IMPORT(PyObject *) PyCell_New(PyObject *); +extern DL_IMPORT(PyObject *) PyCell_Get(PyObject *); +extern DL_IMPORT(int) PyCell_Set(PyObject *, PyObject *); + +#define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) +#define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_TUPLEOBJECT_H */ |