[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: python plugin fork no more
On Thu, Oct 02, 2003 at 06:53:18PM +1000, Peter Zelezny wrote:
> On Tue, 30 Sep 2003 17:14:04 +0300 Marko Kreen <marko@l-t.ee> wrote:
> > ps. Don't apply my recursion patch, I'll send updated version.
>
> Ok, I'll wait for that. You're happy with your unload-exception patch though?
Hm. *reviews* Py_DECREF has if-else, but no do-while(0) around it
and i've seen occasional gcc warnings about that (but not this time).
Still, the following is bit more correct.
--
marko
Index: plugins/python/python.c
===================================================================
RCS file: /cvsroot/xchat/xchat2/plugins/python/python.c,v
retrieving revision 1.7
diff -u -r1.7 python.c
--- plugins/python/python.c 15 Jun 2003 09:10:29 -0000 1.7
+++ plugins/python/python.c 2 Oct 2003 10:19:27 -0000
@@ -1222,7 +1222,12 @@
PyObject *retobj;
retobj = PyObject_CallFunction(hook->callback, "(O)",
hook->userdata);
- Py_DECREF(retobj);
+ if (retobj) {
+ Py_DECREF(retobj);
+ } else {
+ PyErr_Print();
+ PyErr_Clear();
+ }
}
list = list->next;
}