diff options
author | Eli Bendersky <eliben@gmail.com> | 2011-08-12 08:40:39 (GMT) |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2011-08-12 08:40:39 (GMT) |
commit | 47fe5c0d51ccec068d189b53703a8ec71d8f3304 (patch) | |
tree | ed0eacd6409a3accebb868981992e7707f37f38f /Doc/includes/noddy4.c | |
parent | ff3d3e4c7a0f2e26e814d84c228144209d39c26f (diff) | |
download | cpython-47fe5c0d51ccec068d189b53703a8ec71d8f3304.zip cpython-47fe5c0d51ccec068d189b53703a8ec71d8f3304.tar.gz cpython-47fe5c0d51ccec068d189b53703a8ec71d8f3304.tar.bz2 |
Issue #12672: fix code samples in extending/newtypes.html for PEP-7 compliance
Diffstat (limited to 'Doc/includes/noddy4.c')
-rw-r--r-- | Doc/includes/noddy4.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/Doc/includes/noddy4.c b/Doc/includes/noddy4.c index 6a96fac..c747682 100644 --- a/Doc/includes/noddy4.c +++ b/Doc/includes/noddy4.c @@ -27,7 +27,7 @@ Noddy_traverse(Noddy *self, visitproc visit, void *arg) return 0; } -static int +static int Noddy_clear(Noddy *self) { PyObject *tmp; @@ -58,18 +58,16 @@ Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds) self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { self->first = PyUnicode_FromString(""); - if (self->first == NULL) - { + if (self->first == NULL) { Py_DECREF(self); return NULL; - } - + } + self->last = PyUnicode_FromString(""); - if (self->last == NULL) - { + if (self->last == NULL) { Py_DECREF(self); return NULL; - } + } self->number = 0; } @@ -84,10 +82,10 @@ Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) static char *kwlist[] = {"first", "last", "number", NULL}; - if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist, - &first, &last, + if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist, + &first, &last, &self->number)) - return -1; + return -1; if (first) { tmp = self->first; @@ -145,7 +143,7 @@ Noddy_name(Noddy* self) result = PyUnicode_Format(format, args); Py_DECREF(args); - + return result; } @@ -182,10 +180,10 @@ static PyTypeObject NoddyType = { "Noddy objects", /* tp_doc */ (traverseproc)Noddy_traverse, /* tp_traverse */ (inquiry)Noddy_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ Noddy_methods, /* tp_methods */ Noddy_members, /* tp_members */ 0, /* tp_getset */ @@ -208,7 +206,7 @@ static PyModuleDef noddy4module = { }; PyMODINIT_FUNC -PyInit_noddy4(void) +PyInit_noddy4(void) { PyObject* m; |