Perhaps a controversial change: when reporting a callback exception,

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.)
This commit is contained in:
Guido van Rossum 1998-10-13 20:02:39 +00:00
parent ad24ae10df
commit 9f1292d840
1 changed files with 3 additions and 0 deletions

View File

@ -935,6 +935,9 @@ class Tk(Misc, Wm):
def report_callback_exception(self, exc, val, tb): def report_callback_exception(self, exc, val, tb):
import traceback, sys import traceback, sys
sys.stderr.write("Exception in Tkinter callback\n") 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) traceback.print_exception(exc, val, tb)
# Ideally, the classes Pack, Place and Grid disappear, the # Ideally, the classes Pack, Place and Grid disappear, the