summaryrefslogtreecommitdiffstats
path: root/Doc/extending
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-01-03 21:26:05 (GMT)
committerGeorg Brandl <georg@python.org>2009-01-03 21:26:05 (GMT)
commita1c6a1cea5af1d3c7682a8e99b001b0904480e4d (patch)
tree85461d1ba5237440b36f253b197779190226a294 /Doc/extending
parent48310cd3f2e02ced9ae836ccbcb67e9af3097d62 (diff)
downloadcpython-a1c6a1cea5af1d3c7682a8e99b001b0904480e4d.zip
cpython-a1c6a1cea5af1d3c7682a8e99b001b0904480e4d.tar.gz
cpython-a1c6a1cea5af1d3c7682a8e99b001b0904480e4d.tar.bz2
Merged revisions 68221 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r68221 | georg.brandl | 2009-01-03 22:04:55 +0100 (Sat, 03 Jan 2009) | 2 lines Remove tabs from the documentation. ........
Diffstat (limited to 'Doc/extending')
-rw-r--r--Doc/extending/newtypes.rst32
1 files changed, 16 insertions, 16 deletions
diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst
index 66af3bf..ab84a83 100644
--- a/Doc/extending/newtypes.rst
+++ b/Doc/extending/newtypes.rst
@@ -823,8 +823,8 @@ As you can see, the source code closely resembles the :class:`Noddy` examples in
previous sections. We will break down the main differences between them. ::
typedef struct {
- PyListObject list;
- int state;
+ PyListObject list;
+ int state;
} Shoddy;
The primary difference for derived type objects is that the base type's object
@@ -837,10 +837,10 @@ be safely cast to both *PyListObject\** and *Shoddy\**. ::
static int
Shoddy_init(Shoddy *self, PyObject *args, PyObject *kwds)
{
- if (PyList_Type.tp_init((PyObject *)self, args, kwds) < 0)
- return -1;
- self->state = 0;
- return 0;
+ if (PyList_Type.tp_init((PyObject *)self, args, kwds) < 0)
+ return -1;
+ self->state = 0;
+ return 0;
}
In the :attr:`__init__` method for our type, we can see how to call through to
@@ -859,18 +859,18 @@ the module's :cfunc:`init` function. ::
PyMODINIT_FUNC
PyInit_shoddy(void)
{
- PyObject *m;
+ PyObject *m;
- ShoddyType.tp_base = &PyList_Type;
- if (PyType_Ready(&ShoddyType) < 0)
- return NULL;
+ ShoddyType.tp_base = &PyList_Type;
+ if (PyType_Ready(&ShoddyType) < 0)
+ return NULL;
- m = PyModule_Create(&shoddymodule);
- if (m == NULL)
- return NULL;
+ m = PyModule_Create(&shoddymodule);
+ if (m == NULL)
+ return NULL;
- Py_INCREF(&ShoddyType);
- PyModule_AddObject(m, "Shoddy", (PyObject *) &ShoddyType);
+ Py_INCREF(&ShoddyType);
+ PyModule_AddObject(m, "Shoddy", (PyObject *) &ShoddyType);
}
Before calling :cfunc:`PyType_Ready`, the type structure must have the
@@ -1113,7 +1113,7 @@ structure::
typedef struct PyMethodDef {
char *ml_name; /* method name */
PyCFunction ml_meth; /* implementation function */
- int ml_flags; /* flags */
+ int ml_flags; /* flags */
char *ml_doc; /* docstring */
} PyMethodDef;