diff -r 713db33a4ebc Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py Sat Mar 10 23:43:12 2012 +0100 +++ b/Lib/idlelib/PyShell.py Sun Mar 11 20:32:12 2012 -0500 @@ -1221,6 +1221,11 @@ 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 + char = max(s) + start = s.find(char) + 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")