[Python-checkins] python/dist/src/Doc/api newtypes.tex,1.31,1.32
dcjim at users.sourceforge.net
dcjim at users.sourceforge.net
Wed Jul 14 21:08:19 CEST 2004
Update of /cvsroot/python/python/dist/src/Doc/api
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15695/Doc/api
Modified Files:
newtypes.tex
Log Message:
Documented the new Py_VISIT macro to simplify implementation of
tp_traverse handlers. (Tim made me do it. ;)
Index: newtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** newtypes.tex 13 Jul 2004 17:18:10 -0000 1.31
--- newtypes.tex 14 Jul 2004 19:08:17 -0000 1.32
***************
*** 1664,1667 ****
--- 1664,1690 ----
\end{ctypedesc}
+ To simplify writing \member{tp_traverse} handlers, a
+ \cfunction{Py_VISIT()} is provided:
+
+ \begin{cfuncdesc}{void}{Py_VISIT}{PyObject *o}
+ Call the \var{visit} for \var{o} with \var{arg}. If \var{visit}
+ returns a non-zero value, then return it. Using this macro,
+ \member{tp_traverse} handlers look like:
+
+
+ \begin{verbatim}
+ static int
+ my_traverse(Noddy *self, visitproc visit, void *arg)
+ {
+ Py_VISIT(self->foo);
+ Py_VISIT(self->bar);
+ return 0;
+ }
+ \end{verbatim}
+
+ \versionadded{2.4}
+ \end{cfuncdesc}
+
+
The \member{tp_clear} handler must be of the \ctype{inquiry} type, or
\NULL{} if the object is immutable.
More information about the Python-checkins
mailing list