That looks like a good idea in some circumstances.  It would make
debugging easier, but some may think it makes the actual application less
stable.  Maybe it is possible to have this as a runtime configurable
thing.  I should probably look into it further.

James Henstridge.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On 25 Feb 1999, Ture [iso-8859-1] P�lsson wrote:

> I thought it would be nice if exceptions could propagate from
> callbacks, "through" the event loop and out to the top-level python
> code. The folloing code seems to do the trick. Does it break something
> else?
> 
>   -- Ture
> 
> --- gtkmodule.c.~1~   Wed Feb 24 16:43:28 1999
> +++ gtkmodule.c       Thu Feb 25 16:25:36 1999
> @@ -2826,17 +2826,21 @@ static void PyGtk_CallbackMarshal(GtkObj
>    }
>    ret = PyObject_CallObject(func, params);
>    Py_DECREF(params);
> -  if (ret == NULL) {
> -    PyErr_Print();
> -    PyErr_Clear();
> +
> +  /*
> +   * If we dropped out of the called object on an exception, drop out
> +   * of the GTK event loop as well
> +   */
> +  if (PyErr_Occurred()) {
> +    /* fprintf(stderr, "PyGTK_CallbackMarshal: Exception pending\n"); */
> +    gtk_main_quit();
>      return;
>    }
> +
>    GtkRet_FromPyObject(&args[nargs], ret);
>    Py_DECREF(ret);
>  }
>  
> -
> -
>  static
>  void PyGtk_SignalMarshal(GtkObject *object, /*gpointer*/ PyObject *func,
>                         int nparams, GtkArg *args, GtkType *arg_types,
> @@ -3022,6 +3026,19 @@ static GtkArg *PyDict_AsContainerArgs(Py
>       pos++;
>      }
>      return arg;
> +}
> +
> +static PyObject *_wrap_gtk_main(PyObject *self, PyObject *args) {
> +    if (!PyArg_ParseTuple(args, ":gtk_main"))
> +        return NULL;
> +    gtk_main();
> +    if (PyErr_Occurred()) {
> +        /* fprintf(stderr, "_wrap_gtk_main: exception pending\n"); */
> +      return 0;
> +    } else {
> +      Py_INCREF(Py_None);
> +      return Py_None;
> +    }
>  }
>  
>  static PyObject *_wrap_gtk_signal_connect(PyObject *self, PyObject *args) {
> --- gtkmodule_impl.c.~1~      Wed Feb 24 20:51:04 1999
> +++ gtkmodule_impl.c  Thu Feb 25 16:29:51 1999
> @@ -163,14 +163,6 @@ static PyObject *_wrap_gtk_exit(PyObject
>      return Py_None;
>  }
>  
> -static PyObject *_wrap_gtk_main(PyObject *self, PyObject *args) {
> -    if (!PyArg_ParseTuple(args, ":gtk_main"))
> -        return NULL;
> -    gtk_main();
> -    Py_INCREF(Py_None);
> -    return Py_None;
> -}
> -
>  static PyObject *_wrap_gtk_main_quit(PyObject *self, PyObject *args) {
>      if (!PyArg_ParseTuple(args, ":gtk_main_quit"))
>          return NULL;
> 
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to