Quoting James Henstridge <[EMAIL PROTECTED]>:

> > The problem is that timeout_add() doesn't give Python any hints
> > what it should print as traceback. I submitted this as a bug in
> > Python but Guide said this is a bug in PyGTK and I should post
> > this here. The solution is probably that timeout_add() must
> > put a traceback in the newly created callback and print that
> > in case of an error.
> 
> He is right, it isn't a bug in Python :)
> 
> The exception is being caught just after the callback finishes, rather
> than propagating up the call stack.  The traceback only contains
> information about the frames that don't catch the exception.
> 
> You can get complete traceback info by turning on `fatal exceptions'. 
> If
> you turn this on, if an exception occurs within a signal or callback,
> the
> main loop will be quit, and right back to the initial main loop call.
> 
> This can be turned on by defining the environment variable
> PYGTK_FATAL_EXCEPTIONS to something non false (eg. 1).  It checks the
> environment variable through the os.environ dictionary, so you should be
> able to set this from within your script if you want.

This not correct; my app has this turned on and it makes no difference
(it also makes no difference in the test code, just in case :-). The problem
is that at the time where the exception is thrown, there is no stack
trace which Python could print. The solution as I see it is to ask the
traceback module for a stacktrace when timeout_add() is called and pass
that into the C code. The C code which executes the timeout python code
must then check for exceptions and prepend the stacktrace above to the
stacktrace which the exception contains.

I think that python does not allow this (prepending/concatenating stack
traces) and therefore I submitted a bugreport. Since this is a show stopper
right now, I'll try to patch pygtk to fix this.

-- 
==============================================
Sowatec AG,       CH-8330 Pf�ffikon (ZH)
Witzbergstr. 7,   http://www.sowatec.com
Tel: +41-(0)1-952 55 55
Fax: +41-(0)1-952 55 66
----------------------------------------------
Aaron "Optimizer" Digulla, [EMAIL PROTECTED]
==============================================


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to