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

Skip to content

Commit 0f9a34d

Browse files
committed
Added comments for more entries of the type structure in the example
type implementation.
1 parent 2ab0a10 commit 0f9a34d

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

Doc/ext/newtypes.tex

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,20 @@ \section{The Basics
152152
\begin{verbatim}
153153
static PyTypeObject noddy_NoddyType = {
154154
PyObject_HEAD_INIT(NULL)
155-
0,
156-
"Noddy",
157-
sizeof(noddy_NoddyObject),
158-
0,
159-
noddy_noddy_dealloc, /*tp_dealloc*/
160-
0, /*tp_print*/
161-
0, /*tp_getattr*/
162-
0, /*tp_setattr*/
163-
0, /*tp_compare*/
164-
0, /*tp_repr*/
165-
0, /*tp_as_number*/
166-
0, /*tp_as_sequence*/
167-
0, /*tp_as_mapping*/
168-
0, /*tp_hash */
155+
0, /* ob_size */
156+
"Noddy", /* tp_name */
157+
sizeof(noddy_NoddyObject), /* tp_basicsize */
158+
0, /* tp_itemsize */
159+
noddy_noddy_dealloc, /* tp_dealloc */
160+
0, /* tp_print */
161+
0, /* tp_getattr */
162+
0, /* tp_setattr */
163+
0, /* tp_compare */
164+
0, /* tp_repr */
165+
0, /* tp_as_number */
166+
0, /* tp_as_sequence */
167+
0, /* tp_as_mapping */
168+
0, /* tp_hash */
169169
};
170170
\end{verbatim}
171171

@@ -194,7 +194,7 @@ \section{The Basics
194194
oppourtunity --- in \cfunction{initnoddy()}.
195195

196196
\begin{verbatim}
197-
0,
197+
0, /* ob_size */
198198
\end{verbatim}
199199

200200
The \member{ob_size} field of the header is not used; it's presence in
@@ -203,7 +203,7 @@ \section{The Basics
203203
versions of Python. Always set this field to zero.
204204

205205
\begin{verbatim}
206-
"Noddy",
206+
"Noddy", /* tp_name */
207207
\end{verbatim}
208208

209209
The name of our type. This will appear in the default textual
@@ -217,14 +217,14 @@ \section{The Basics
217217
\end{verbatim}
218218

219219
\begin{verbatim}
220-
sizeof(noddy_NoddyObject),
220+
sizeof(noddy_NoddyObject), /* tp_basicsize */
221221
\end{verbatim}
222222

223223
This is so that Python knows how much memory to allocate when you call
224224
\cfunction{PyObject_New}.
225225

226226
\begin{verbatim}
227-
0,
227+
0, /* tp_itemsize */
228228
\end{verbatim}
229229

230230
This has to do with variable length objects like lists and strings.
@@ -236,7 +236,7 @@ \section{The Basics
236236
the deallocation function.
237237

238238
\begin{verbatim}
239-
noddy_noddy_dealloc, /*tp_dealloc*/
239+
noddy_noddy_dealloc, /* tp_dealloc */
240240
\end{verbatim}
241241

242242
From here, all the type methods are \NULL, so I won't go over them yet

0 commit comments

Comments
 (0)