@@ -2340,3 +2340,53 @@ \subsection{CObjects \label{cObjects}}
23402340 Returns the description \ctype {void *} that the \ctype {PyCObject}
23412341 \var {self} was created with.
23422342\end {cfuncdesc }
2343+
2344+
2345+ \subsection {Cell Objects \label {cell-objects } }
2346+
2347+ `` Cell'' objects are used to implement variables referenced by
2348+ multiple scopes. For each such variable, a cell object is created to
2349+ store the value; the local variables of each stack frame that
2350+ references the value contains a reference to the cells from outer
2351+ scopes which also use that variable. When the value is accessed, the
2352+ value contained in the cell is used instead of the cell object
2353+ itself. This de-referencing of the cell object requires support from
2354+ the generated byte-code; these are not automatically de-referenced
2355+ when accessed. Cell objects are not likely to be useful elsewhere.
2356+
2357+ \begin {cvardesc }{PyTypeObject}{PyCell_Type}
2358+ The type object corresponding to cell objects
2359+ \end {cvardesc }
2360+
2361+ \begin {cfuncdesc }{int}{PyCell_Check}{ob}
2362+ Return true if \var {ob} is a cell object; \var {ob} must not be
2363+ \NULL .
2364+ \end {cfuncdesc }
2365+
2366+ \begin {cfuncdesc }{PyObject*}{PyCell_New}{PyObject *ob}
2367+ Create and return a new cell object containing the value \var {ob}.
2368+ The parameter may be \NULL .
2369+ \end {cfuncdesc }
2370+
2371+ \begin {cfuncdesc }{PyObject*}{PyCell_Get}{PyObject *cell}
2372+ Return the contents of the cell \var {cell}.
2373+ \end {cfuncdesc }
2374+
2375+ \begin {cfuncdesc }{PyObject*}{PyCell_GET}{PyObject *cell}
2376+ Return the contents of the cell \var {cell}, but without checking
2377+ that \var {cell} is non-\NULL {} and a call object.
2378+ \end {cfuncdesc }
2379+
2380+ \begin {cfuncdesc }{int}{PyCell_Set}{PyObject *cell, PyObject *value}
2381+ Set the contents of the cell object \var {cell} to \var {value}. This
2382+ releases the reference to any current content of the cell.
2383+ \var {value} may be \NULL . \var {cell} must be non-\NULL ; if it is
2384+ not a cell object, \code {-1} will be returned. On success, \code {0}
2385+ will be returned.
2386+ \end {cfuncdesc }
2387+
2388+ \begin {cfuncdesc }{void}{PyCell_SET}{PyObject *cell, PyObject *value}
2389+ Sets the value of the cell object \var {cell} to \var {value}. No
2390+ reference counts are adjusted, and no checks are made for safety;
2391+ \var {cell} must be non-\NULL {} and must be a cell object.
2392+ \end {cfuncdesc }
0 commit comments