changeset 1453:2d537c1b8dbe

cdefer: Adapted and disabled code only used with errbacks.
author Marcel Keller <mkeller@cs.au.dk>
date Tue, 20 Jul 2010 15:48:49 +0200
parents 9ecbbe1f33d8
children 33aa72138a5e
files viff/cdefer.c
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/viff/cdefer.c	Tue Jul 20 13:30:49 2010 +0200
+++ b/viff/cdefer.c	Tue Jul 20 15:48:49 2010 +0200
@@ -280,13 +280,18 @@
     PyObject *result;
     cdefer_Callback *cb;
 
+    if (!PyCallable_Check(callback)) {
+	PyErr_SetNone(PyExc_AssertionError);
+	return NULL;
+    }
+
+    /*
     if (callback != Py_None) {
         if (!PyCallable_Check(callback)) {
             PyErr_SetNone(PyExc_AssertionError);
             return NULL;
         }
     }
-    /*
     if (errback != Py_None) {
         if (!PyCallable_Check(errback)) {
             PyErr_SetNone(PyExc_AssertionError);
@@ -424,10 +429,15 @@
     if (!errback) {
         return NULL;
     }
+    /*
     result = cdefer_Deferred__addCallbacks(self, Py_None, errback, Py_None,
         Py_None, errbackArgs, errbackKeywords);
+    */
     Py_DECREF(errback);
     Py_DECREF(errbackArgs);
+
+    Py_INCREF(self);
+    result = (PyObject *)self;
     return result;
 }
 
@@ -551,12 +561,14 @@
 		PyErr_SetString(PyExc_RuntimeError, "NULL callback.");
                 return NULL;
             }
+	    /*
             if (callback == Py_None) {
-		Py_DECREF(Py_None);
-		self->callbacks->func = NULL;
-                self->callbacks = self->callbacks->next;
+                self->callbacks = cdefer_Callback_free(self->callbacks);
+		if (!self->callbacks)
+		    self->last_callback = NULL;
                 continue;
             }
+	    */
 
 	    args = self->callbacks->args;
             if (!args) {