From f2853162d7cd949136f6055afbcf41daa7b03bcf Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Thu, 13 Dec 2001 00:30:31 +0000 Subject: always print and clear the exceptions in callback marshalers. People who 2001-12-12 Matt Wilson * gobjectmodule.c (pyg_closure_marshal, pyg_signal_class_closure_marshal): always print and clear the exceptions in callback marshalers. People who want to catch these exceptions and make them fatal should use sys.excepthook. (pyg_fatal_exceptions_notify, pyg_fatal_exceptions_notify_add, pyg_fatal_exceptions_remove): remove now unused functions. Also remove them from the PyGObject_API. * gtk/pygtk.h (PyGtk_FatalExceptions): remove. * gtk/pygtk-private.h (PyGtk_FatalExceptions): remove. * gtk/gtkmodule.c (init_gtk): don't bother with PYGTK_FATAL_EXCEPTIONS. (pygtk_main_quit): remove unused code. * gtk/gtk.override (_wrap_gtk_item_factory_create_items, _wrap_gtk_menu_popup): likewise, always print and clear the exception. --- gobject/gobjectmodule.c | 42 ++++-------------------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) (limited to 'gobject/gobjectmodule.c') diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index b0f27bf..d76f353 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -975,10 +975,8 @@ pyg_closure_marshal(GClosure *closure, } ret = PyObject_CallObject(pc->callback, params); if (ret == NULL) { - if (!pyg_fatal_exceptions_notify()) { - PyErr_Print(); - PyErr_Clear(); - } + PyErr_Print(); + PyErr_Clear(); return; } if (return_value) @@ -1088,10 +1086,8 @@ pyg_signal_class_closure_marshal(GClosure *closure, ret = PyObject_CallObject(method, params); if (ret == NULL) { - if (!pyg_fatal_exceptions_notify()) { - PyErr_Print(); - PyErr_Clear(); - } + PyErr_Print(); + PyErr_Clear(); /* XXXX - clean up if threading was used */ Py_DECREF(method); return; @@ -2324,33 +2320,6 @@ pyg_flags_add_constants(PyObject *module, GType flags_type, g_type_class_unref(fclass); } -static int -pyg_fatal_exceptions_notify(void) -{ - GList *tmp_list = pygobject_exception_notifiers; - if (!tmp_list) - return 0; - while (tmp_list != NULL) { - PyGFatalExceptionFunc notifier = tmp_list->data; - (* notifier)(); - tmp_list = g_list_next (tmp_list); - } - return 1; -} -static void -pyg_fatal_exceptions_notify_add(PyGFatalExceptionFunc func) -{ - pygobject_exception_notifiers = - g_list_append(pygobject_exception_notifiers, func); -} - -static void -pyg_fatal_exceptions_notify_remove(PyGFatalExceptionFunc func) -{ - pygobject_exception_notifiers = - g_list_remove(pygobject_exception_notifiers, func); -} - static gboolean pyg_error_check(GError **error) { @@ -2408,9 +2377,6 @@ static struct _PyGObject_Functions functions = { pyg_enum_add_constants, pyg_flags_add_constants, - pyg_fatal_exceptions_notify_add, - pyg_fatal_exceptions_notify_remove, - pyg_constant_strip_prefix, pyg_error_check, -- cgit