[Python-checkins] cpython (2.7): Issue #22384: An exception in Tkinter callback no longer crashes the program

serhiy.storchaka python-checkins at python.org
Sun Sep 14 20:20:49 CEST 2014


http://hg.python.org/cpython/rev/994a16b51544
changeset:   92423:994a16b51544
branch:      2.7
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Sep 14 21:17:16 2014 +0300
summary:
  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.

files:
  Lib/lib-tk/Tkinter.py |  7 +++++--
  1 files changed, 5 insertions(+), 2 deletions(-)


diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -1879,9 +1879,12 @@
         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

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list