Commit 7be46274 authored by Jim Fulton's avatar Jim Fulton

Fixed bug in implementation of tp_init function. It should be an int

function, not a PyObject *.
parent 2e5c7b77
...@@ -43,7 +43,7 @@ Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds) ...@@ -43,7 +43,7 @@ Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return (PyObject *)self; return (PyObject *)self;
} }
static PyObject * static int
Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) Noddy_init(Noddy *self, PyObject *args, PyObject *kwds)
{ {
PyObject *first=NULL, *last=NULL; PyObject *first=NULL, *last=NULL;
...@@ -53,7 +53,7 @@ Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) ...@@ -53,7 +53,7 @@ Noddy_init(Noddy *self, PyObject *args, PyObject *kwds)
if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist, if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist,
&first, &last, &first, &last,
&self->number)) &self->number))
return NULL; return -1;
if (first) { if (first) {
Py_XDECREF(self->first); Py_XDECREF(self->first);
...@@ -67,8 +67,7 @@ Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) ...@@ -67,8 +67,7 @@ Noddy_init(Noddy *self, PyObject *args, PyObject *kwds)
self->last = last; self->last = last;
} }
Py_INCREF(Py_None); return 0;
return Py_None;
} }
......
...@@ -43,7 +43,7 @@ Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds) ...@@ -43,7 +43,7 @@ Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return (PyObject *)self; return (PyObject *)self;
} }
static PyObject * static int
Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) Noddy_init(Noddy *self, PyObject *args, PyObject *kwds)
{ {
PyObject *first=NULL, *last=NULL; PyObject *first=NULL, *last=NULL;
...@@ -53,7 +53,7 @@ Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) ...@@ -53,7 +53,7 @@ Noddy_init(Noddy *self, PyObject *args, PyObject *kwds)
if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist, if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist,
&first, &last, &first, &last,
&self->number)) &self->number))
return NULL; return -1;
if (first) { if (first) {
Py_DECREF(self->first); Py_DECREF(self->first);
...@@ -67,8 +67,7 @@ Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) ...@@ -67,8 +67,7 @@ Noddy_init(Noddy *self, PyObject *args, PyObject *kwds)
self->last = last; self->last = last;
} }
Py_INCREF(Py_None); return 0;
return Py_None;
} }
static PyMemberDef Noddy_members[] = { static PyMemberDef Noddy_members[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment