From: Martin v. Löwis Date: Wed, 25 Jul 2012 09:33:02 +0000 (+0200) Subject: merge 3.2 X-Git-Tag: v3.3.0b2~109 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=099414875bdfc7eaf5a7c84ab34cd24a489b419e;p=thirdparty%2FPython%2Fcpython.git merge 3.2 --- 099414875bdfc7eaf5a7c84ab34cd24a489b419e diff --cc Lib/idlelib/NEWS.txt index 6b430b5bf155,3a641a019eb9..1d87443bd49b --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@@ -1,11 -1,10 +1,13 @@@ -What's New in IDLE 3.2.4? +What's New in IDLE 3.3.0? ========================= + - Issue #7163: Propagate return value of sys.stdout.write. + - Issue #15318: Prevent writing to sys.stdin. +- Issue #4832: Modify IDLE to save files with .py extension by + default on Windows and OS X (Tk 8.5) as it already does with X11 Tk. + - Issue #13532, #15319: Check that arguments to sys.stdout.write are strings. - Issue # 12510: Attempt to get certain tool tips no longer crashes IDLE. diff --cc Lib/idlelib/PyShell.py index 0a05d78456b7,0eae7c5cee38..e0b8c2981684 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@@ -1233,19 -1227,9 +1233,19 @@@ class PyShell(OutputWindow) self.set_line_and_column() def write(self, s, tags=()): + if isinstance(s, str) and len(s) and max(s) > '\uffff': + # Tk doesn't support outputting non-BMP characters + # Let's assume what printed string is not very long, + # find first non-BMP character and construct informative + # UnicodeEncodeError exception. + for start, char in enumerate(s): + if char > '\uffff': + break + raise UnicodeEncodeError("UCS-2", char, start, start+1, + 'Non-BMP character not supported in Tk') try: self.text.mark_gravity("iomark", "right") - OutputWindow.write(self, s, tags, "iomark") + count = OutputWindow.write(self, s, tags, "iomark") self.text.mark_gravity("iomark", "left") except: raise ###pass # ### 11Aug07 KBK if we are expecting exceptions