]> granicus.if.org Git - python/commitdiff
Issue #22384: An exception in Tkinter callback no longer crashes the program
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 14 Sep 2014 18:17:16 +0000 (21:17 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 14 Sep 2014 18:17:16 +0000 (21:17 +0300)
when it is run with pythonw.exe.

Documented that Tk.report_callback_exception() is purposed to be overriden in
applications.

Lib/lib-tk/Tkinter.py

index 4de2605b66a1ae941b2f0108d608ad011ff382cc..8d21717b467966832bb66f8e48508780cf24c699 100644 (file)
@@ -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