[Python-checkins] cpython (merge 3.4 -> default): 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/7191b14ca312
changeset: 92425:7191b14ca312
parent: 92421:6cdb7981eb0f
parent: 92424:c62fad86fac3
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sun Sep 14 21:18:31 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/tkinter/__init__.py | 7 +++++--
 Misc/NEWS | 3 +++
 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -1919,9 +1919,12 @@
 if os.path.isfile(base_py):
 exec(open(base_py).read(), 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.stderr.write("Exception in Tkinter callback\n")
+ print("Exception in Tkinter callback", file=sys.stderr)
 sys.last_type = exc
 sys.last_value = val
 sys.last_traceback = tb
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -132,6 +132,9 @@
 Library
 -------
 
+- Issue #22384: An exception in Tkinter callback no longer crashes the program
+ when it is run with pythonw.exe.
+
 - Issue #22168: Prevent turtle AttributeError with non-default Canvas on OS X.
 
 - Issue #21147: sqlite3 now raises an exception if the request contains a null
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /