]> granicus.if.org Git - python/commitdiff
Perhaps a controversial change: when reporting a callback exception,
authorGuido van Rossum <guido@python.org>
Tue, 13 Oct 1998 20:02:39 +0000 (20:02 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 13 Oct 1998 20:02:39 +0000 (20:02 +0000)
assign the exception info to sys.last_{type,value,traceback}.  That
way, an introspective Tkinter app can inspect its own stack trace.

(The controversy is that it would keep some objects alive, but that's
probably no big deal.)

Lib/lib-tk/Tkinter.py

index 4662f3b0f0d472edaf3287029c44037210f8abb7..0f4c7135337c09a8e5532afda2d78f346a2d0610 100644 (file)
@@ -935,6 +935,9 @@ class Tk(Misc, Wm):
        def report_callback_exception(self, exc, val, tb):
                import traceback, sys
                sys.stderr.write("Exception in Tkinter callback\n")
+               sys.last_type = exc
+               sys.last_value = val
+               sys.last_traceback = tb
                traceback.print_exception(exc, val, tb)
 
 # Ideally, the classes Pack, Place and Grid disappear, the