summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-09-14 18:18:31 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-09-14 18:18:31 (GMT)
commit4ff91eb5e38517222ab4e65c1f9d0757c29cebc7 (patch)
tree0669c69168dbaccb0d823876ecacc6f65bf9cff5
parentf42cbff27e572903a1f8c7315a87a02d68e9c637 (diff)
parent9502487781315a5151b5f3e3067baad7ce54e85d (diff)
downloadcpython-4ff91eb5e38517222ab4e65c1f9d0757c29cebc7.zip
cpython-4ff91eb5e38517222ab4e65c1f9d0757c29cebc7.tar.gz
cpython-4ff91eb5e38517222ab4e65c1f9d0757c29cebc7.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.
-rw-r--r--Lib/tkinter/__init__.py7
-rw-r--r--Misc/NEWS3
2 files changed, 8 insertions, 2 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index 5a3dd12..beb0a73 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -1919,9 +1919,12 @@ class Tk(Misc, Wm):
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
index 21b0638..ea16479 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -132,6 +132,9 @@ Core and Builtins
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