summaryrefslogtreecommitdiff
path: root/Lib/lib-tk/Tkinter.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-10-13 20:02:39 +0000
committerGuido van Rossum <guido@python.org>1998-10-13 20:02:39 +0000
commit84dca6d3c4fd7e811a37591eb2ef3eb68714c9af (patch)
tree74da1b892cca970e9d3bab373d75f5b962385806 /Lib/lib-tk/Tkinter.py
parenta85e695888fa5d300d3c3d7ad0506f7929133c00 (diff)
downloadcpython-84dca6d3c4fd7e811a37591eb2ef3eb68714c9af.tar.gz
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.)
Diffstat (limited to 'Lib/lib-tk/Tkinter.py')
-rw-r--r--Lib/lib-tk/Tkinter.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index 4662f3b0f0..0f4c713533 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -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