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 12:44:23 2012 -0500 @@ -431,6 +431,9 @@ self.rpcclt.close() self.terminate_subprocess() console = self.tkconsole + if console.reading: + console.endoffile = True + console.top.quit() was_executing = console.executing console.executing = False self.spawn_subprocess() @@ -1016,7 +1019,6 @@ line = self.text.get("iomark", "end-1c") if len(line) == 0: # may be EOF if we quit our mainloop with Ctrl-C line = "\n" - self.resetoutput() if self.canceled: self.canceled = 0 if not use_subprocess: @@ -1024,6 +1026,8 @@ if self.endoffile: self.endoffile = 0 line = "" + if line: + self.resetoutput() return line def isatty(self):