Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cd8474e

Browse files
committed
Add documentation for the PyCell* APIs.
1 parent ccf0465 commit cd8474e

2 files changed

Lines changed: 67 additions & 0 deletions

File tree

Doc/api/concrete.tex

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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}

Doc/api/refcounts.dat

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,23 @@ PyCObject_FromVoidPtrAndDesc:void(*)(void*,void*):destr::
6767
PyCObject_GetDesc:void*:::
6868
PyCObject_GetDesc:PyObject*:self:0:
6969

70+
PyCell_New:PyObject*::+1:
71+
PyCell_New:PyObject*:ob:0:
72+
73+
PyCell_GET:PyObject*::0:
74+
PyCell_GET:PyObject*:ob:0:
75+
76+
PyCell_Get:PyObject*::+1:
77+
PyCell_Get:PyObject*:cell:0:
78+
79+
PyCell_SET:void:::
80+
PyCell_SET:PyObject*:cell:0:
81+
PyCell_SET:PyObject*:value:0:
82+
83+
PyCell_Set:int:::
84+
PyCell_Set:PyObject*:cell:0:
85+
PyCell_Set:PyObject*:value:0:
86+
7087
PyCallIter_New:PyObject*::+1:
7188
PyCallIter_New:PyObject*:callable::
7289
PyCallIter_New:PyObject*:sentinel::

0 commit comments

Comments
 (0)