changeset: 92424:c62fad86fac3 branch: 3.4 parent: 92420:13acbb8939a8 user: Serhiy Storchaka date: Sun Sep 14 21:17:32 2014 +0300 files: Lib/tkinter/__init__.py Misc/NEWS description: 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. diff -r 13acbb8939a8 -r c62fad86fac3 Lib/tkinter/__init__.py --- a/Lib/tkinter/__init__.py Sun Sep 14 16:20:20 2014 +0300 +++ b/Lib/tkinter/__init__.py Sun Sep 14 21:17:32 2014 +0300 @@ -1917,9 +1917,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 -r 13acbb8939a8 -r c62fad86fac3 Misc/NEWS --- a/Misc/NEWS Sun Sep 14 16:20:20 2014 +0300 +++ b/Misc/NEWS Sun Sep 14 21:17:32 2014 +0300 @@ -32,6 +32,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