summaryrefslogtreecommitdiffstats
path: root/Doc/ext
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-03-28 23:45:22 (GMT)
committerFred Drake <fdrake@acm.org>2002-03-28 23:45:22 (GMT)
commit0f9a34da2cdc597f64556bdaab4c63d77ac359e9 (patch)
tree38689720e2351755ffc0df80fbcf212da42a54d7 /Doc/ext
parent2ab0a10913aebb663b2729add2a5f30a6cdbd54e (diff)
downloadcpython-0f9a34da2cdc597f64556bdaab4c63d77ac359e9.zip
cpython-0f9a34da2cdc597f64556bdaab4c63d77ac359e9.tar.gz
cpython-0f9a34da2cdc597f64556bdaab4c63d77ac359e9.tar.bz2
Added comments for more entries of the type structure in the example
type implementation.
Diffstat (limited to 'Doc/ext')
-rw-r--r--Doc/ext/newtypes.tex38
1 files changed, 19 insertions, 19 deletions
diff --git a/Doc/ext/newtypes.tex b/Doc/ext/newtypes.tex
index 5371841..15742e3 100644
--- a/Doc/ext/newtypes.tex
+++ b/Doc/ext/newtypes.tex
@@ -152,20 +152,20 @@ Moving on, we come to the crunch --- the type object.
\begin{verbatim}
static PyTypeObject noddy_NoddyType = {
PyObject_HEAD_INIT(NULL)
- 0,
- "Noddy",
- sizeof(noddy_NoddyObject),
- 0,
- noddy_noddy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
+ 0, /* ob_size */
+ "Noddy", /* tp_name */
+ sizeof(noddy_NoddyObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ noddy_noddy_dealloc, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
};
\end{verbatim}
@@ -194,7 +194,7 @@ conforming C and some compilers complain. So instead we fill in the
oppourtunity --- in \cfunction{initnoddy()}.
\begin{verbatim}
- 0,
+ 0, /* ob_size */
\end{verbatim}
The \member{ob_size} field of the header is not used; it's presence in
@@ -203,7 +203,7 @@ binary compatibility with extension modules compiled for older
versions of Python. Always set this field to zero.
\begin{verbatim}
- "Noddy",
+ "Noddy", /* tp_name */
\end{verbatim}
The name of our type. This will appear in the default textual
@@ -217,14 +217,14 @@ TypeError: cannot add type "Noddy" to string
\end{verbatim}
\begin{verbatim}
- sizeof(noddy_NoddyObject),
+ sizeof(noddy_NoddyObject), /* tp_basicsize */
\end{verbatim}
This is so that Python knows how much memory to allocate when you call
\cfunction{PyObject_New}.
\begin{verbatim}
- 0,
+ 0, /* tp_itemsize */
\end{verbatim}
This has to do with variable length objects like lists and strings.
@@ -236,7 +236,7 @@ implement many of these, but as mentioned above you have to implement
the deallocation function.
\begin{verbatim}
- noddy_noddy_dealloc, /*tp_dealloc*/
+ noddy_noddy_dealloc, /* tp_dealloc */
\end{verbatim}
From here, all the type methods are \NULL, so I won't go over them yet