summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-09-14 18:17:16 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-09-14 18:17:16 (GMT)
commit2971c5e97d657d76141b7dbf694bb0546562ab4a (patch)
treed922f2a862ef0f2466b7c356d20eb259cc76f6ef /Lib
parent7644ff1fb1860ffb5ce83342349f8b905dac633f (diff)
downloadcpython-2971c5e97d657d76141b7dbf694bb0546562ab4a.zip
cpython-2971c5e97d657d76141b7dbf694bb0546562ab4a.tar.gz
cpython-2971c5e97d657d76141b7dbf694bb0546562ab4a.tar.bz2
Issue #22384: An exception in Tkinter callback no longer crashes the program
when it is run with pythonw.exe. Documented that Tk.report_callback_exception() is purposed to be overriden in applications.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/lib-tk/Tkinter.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index 4de2605..8d21717 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -1879,9 +1879,12 @@ class Tk(Misc, Wm):
if os.path.isfile(base_py):
execfile(base_py, dir)
def report_callback_exception(self, exc, val, tb):
- """Internal function. It reports exception on sys.stderr."""
+ """Report callback exception on sys.stderr.
+
+ Applications may want to override this internal function, and
+ should when sys.stderr is None."""
import traceback, sys
- sys.stderr.write("Exception in Tkinter callback\n")
+ print >>sys.stderr, "Exception in Tkinter callback"
sys.last_type = exc
sys.last_value = val
sys.last_traceback = tb