summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark McLoughlin <mark@skynet.ie>2005-05-09 20:01:40 +0000
committerJohan Dahlin <johan@src.gnome.org>2005-05-09 20:01:40 +0000
commit46323c8148108e48abf6725646c5ab68406f2a8f (patch)
tree4c5df1f3f3b7f72e52c000f803dfc324b139a1da
parentd00fbae42480e2fa0b911d386d45fd8e046eef88 (diff)
downloadpygobject-46323c8148108e48abf6725646c5ab68406f2a8f.tar.gz
Fix for bug #303573 - "exceptions raised in a child watch handler are
2005-05-09 Mark McLoughlin <mark@skynet.ie> Fix for bug #303573 - "exceptions raised in a child watch handler are silently swallowed" * gobject/gobjectmodule.c: (child_watch_func), (_pyg_spawn_async_callback): if PyObject_CallFunction() returns NULL, print a traceback of the exception. * tests/test_mainloop.py: add testcase. * tests/Makefile.am: add test_mainloop.py Reviewed by Johan Dahlin <johan@gnome.org>
-rw-r--r--gobject/gobjectmodule.c12
-rw-r--r--tests/Makefile.am1
2 files changed, 11 insertions, 2 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index 0f1ba8f0..10aea450 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -1832,7 +1832,12 @@ child_watch_func(GPid pid, gint status, gpointer data)
child_data->data);
else
retval = PyObject_CallFunction(child_data->func, "ii", pid, status);
- Py_XDECREF(retval);
+
+ if (retval)
+ Py_DECREF(retval);
+ else
+ PyErr_Print();
+
pyg_gil_state_release(gil);
}
@@ -1894,7 +1899,10 @@ _pyg_spawn_async_callback(gpointer user_data)
retval = PyObject_CallFunction(data->func, "O", data->data);
else
retval = PyObject_CallFunction(data->func, NULL);
- Py_XDECREF(retval);
+ if (retval)
+ Py_DECREF(retval);
+ else
+ PyErr_Print();
Py_DECREF(data->func);
Py_XDECREF(data->data);
g_free(data);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 650dd5a3..9b0b8de0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -23,6 +23,7 @@ tests = \
test_dialog.py \
test_enum.py \
test_gtype.py \
+ test_mainloop.py \
test_radiobutton.py \
test_signal.py \
test_subprocess.py \