]> granicus.if.org Git - python/commitdiff
Fixed bug in implementation of tp_init function. It should be an int
authorJim Fulton <jim@zope.com>
Sat, 28 Jun 2003 11:54:03 +0000 (11:54 +0000)
committerJim Fulton <jim@zope.com>
Sat, 28 Jun 2003 11:54:03 +0000 (11:54 +0000)
function, not a PyObject *.

Doc/ext/noddy2.c
Doc/ext/noddy3.c

index fcce2abd97d1136f6621ab6489f0cb4561eb534d..03fe2888f9d0121a4b7ecede69306afdfa908142 100644 (file)
@@ -43,7 +43,7 @@ Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     return (PyObject *)self;
 }
 
-static PyObject *
+static int
 Noddy_init(Noddy *self, PyObject *args, PyObject *kwds)
 {
     PyObject *first=NULL, *last=NULL;
@@ -53,7 +53,7 @@ Noddy_init(Noddy *self, PyObject *args, PyObject *kwds)
     if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist, 
                                       &first, &last, 
                                       &self->number))
-        return NULL
+        return -1
 
     if (first) {
         Py_XDECREF(self->first);
@@ -67,8 +67,7 @@ Noddy_init(Noddy *self, PyObject *args, PyObject *kwds)
         self->last = last;
     }
 
-    Py_INCREF(Py_None);
-    return Py_None;
+    return 0;
 }
 
 
index 08ac31ec6a2b5d7bc6fc88c519666162c458e50c..9984a3d0d1a0c286b48b0715641d7dcdafd80260 100644 (file)
@@ -43,7 +43,7 @@ Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     return (PyObject *)self;
 }
 
-static PyObject *
+static int
 Noddy_init(Noddy *self, PyObject *args, PyObject *kwds)
 {
     PyObject *first=NULL, *last=NULL;
@@ -53,7 +53,7 @@ Noddy_init(Noddy *self, PyObject *args, PyObject *kwds)
     if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist, 
                                       &first, &last, 
                                       &self->number))
-        return NULL
+        return -1
 
     if (first) {
         Py_DECREF(self->first);
@@ -67,8 +67,7 @@ Noddy_init(Noddy *self, PyObject *args, PyObject *kwds)
         self->last = last;
     }
 
-    Py_INCREF(Py_None);
-    return Py_None;
+    return 0;
 }
 
 static PyMemberDef Noddy_members[] = {