From 22d22bf27685c406155ba557fc8040eba3960ea1 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Sat, 5 Nov 2011 22:36:44 -0700 Subject: Issue #13300: Fix IDLE Restart Shell command failure introduced by 3a5a0943b201. Do not close listening socket on subprocess restart. --- Lib/idlelib/PyShell.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Lib/idlelib/PyShell.py') diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index 33deb457a4..ea3a5d9a8e 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -459,6 +459,10 @@ class ModifiedInterpreter(InteractiveInterpreter): threading.Thread(target=self.__request_interrupt).start() def kill_subprocess(self): + try: + self.rpcclt.listening_sock.close() + except AttributeError: # no socket + pass try: self.rpcclt.close() except AttributeError: # no socket -- cgit v1.2.1 From cdaf91f7ebce2bb86c1692dd5c40b9b1e6db8d4c Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Wed, 14 Mar 2012 13:22:12 -0700 Subject: Issue #14200: Idle shell crash on printing non-BMP unicode character. UnicodeEncodeError is raised for strings contains non-BMP characters. For eval results unicode escaping is used, print() calls display exception with traceback as usual. --- Lib/idlelib/PyShell.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Lib/idlelib/PyShell.py') diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index f884b28d67..6b75a8d4d0 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -1221,6 +1221,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") OutputWindow.write(self, s, tags, "iomark") -- cgit v1.2.1 From ef2576bed55e5f35c76c4536a802cea228ef873f Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Tue, 20 Mar 2012 23:03:26 +0200 Subject: #3573: idle now doesn't hungs if launched as: idle -e Patch by Guilherme Polo. --- Lib/idlelib/PyShell.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Lib/idlelib/PyShell.py') diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index 6b75a8d4d0..d7edce501f 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -1403,8 +1403,10 @@ def main(): if enable_edit: if not (cmd or script): - for filename in args: - flist.open(filename) + for filename in args[:]: + if flist.open(filename) is None: + # filename is a directory actually, disconsider it + args.remove(filename) if not args: flist.new() if enable_shell: -- cgit v1.2.1 From 937ff1dbf418dd86a7cd254a55ddbed05bc01207 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Sun, 25 Mar 2012 11:43:02 +0300 Subject: =?UTF-8?q?Issue=20#14200=20=E2=80=94=20now=20displayhook=20for=20?= =?UTF-8?q?IDLE=20works=20in=20non-subprocess=20mode=20as=20well=20as=20su?= =?UTF-8?q?bprecess.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lib/idlelib/PyShell.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Lib/idlelib/PyShell.py') diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index d7edce501f..c524d61e4e 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -999,6 +999,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() -- cgit v1.2.1