diff options
Diffstat (limited to 'Doc/ext/noddy3.c')
-rw-r--r-- | Doc/ext/noddy3.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/ext/noddy3.c b/Doc/ext/noddy3.c index 9984a3d..60260ad 100644 --- a/Doc/ext/noddy3.c +++ b/Doc/ext/noddy3.c @@ -46,25 +46,27 @@ Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds) static int Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) { - PyObject *first=NULL, *last=NULL; + PyObject *first=NULL, *last=NULL, *tmp; static char *kwlist[] = {"first", "last", "number", NULL}; - if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist, + if (! PyArg_ParseTupleAndKeywords(args, kwds, "|SSi", kwlist, &first, &last, &self->number)) return -1; if (first) { - Py_DECREF(self->first); + tmp = self->first; Py_INCREF(first); self->first = first; + Py_DECREF(tmp); } if (last) { - Py_DECREF(self->last); + tmp = self->last; Py_INCREF(last); self->last = last; + Py_DECREF(tmp); } return 0; |