diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-25 12:20:39 +0200 |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-25 12:20:39 +0200 |
commit | 5da94bec31a8296c68fee6b067d9ec69578c3673 (patch) | |
tree | 72a3d44aab9df6e23bc5fdd0f6530c3531ec3c20 /Lib/idlelib/PyShell.py | |
parent | ba86d24df9cb0e625dbd9dab22d64ba00e09d326 (diff) | |
parent | 767c99333331f86f236697e78346ecf91a84c835 (diff) | |
download | cpython-5da94bec31a8296c68fee6b067d9ec69578c3673.tar.gz |
Add test coverage for os.removedirs (#16775)
Diffstat (limited to 'Lib/idlelib/PyShell.py')
-rw-r--r-- | Lib/idlelib/PyShell.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index fb47b994d1..3b78f38fac 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -483,6 +483,10 @@ class ModifiedInterpreter(InteractiveInterpreter): def kill_subprocess(self): try: + self.rpcclt.listening_sock.close() + except AttributeError: # no socket + pass + try: self.rpcclt.close() except AttributeError: # no socket pass @@ -1011,6 +1015,8 @@ class PyShell(OutputWindow): return False else: nosub = "==== No Subprocess ====" + sys.displayhook = rpc.displayhook + self.write("Python %s on %s\n%s\n%s" % (sys.version, sys.platform, self.COPYRIGHT, nosub)) self.showprompt() @@ -1233,6 +1239,16 @@ 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") count = OutputWindow.write(self, s, tags, "iomark") |