diff options
author | Kurt B. Kaiser <kbk@shore.net> | 2004-12-23 04:20:59 (GMT) |
---|---|---|
committer | Kurt B. Kaiser <kbk@shore.net> | 2004-12-23 04:20:59 (GMT) |
commit | 5c3df35b6b1f48cb48c91b0c7a8754590a694171 (patch) | |
tree | 00ccc7bcc4b1fc54472ca994cadc9c1ff4886720 /Lib/idlelib | |
parent | ee4bb6612a382af49cbb17629f9430afd7f746fa (diff) | |
download | cpython-5c3df35b6b1f48cb48c91b0c7a8754590a694171.zip cpython-5c3df35b6b1f48cb48c91b0c7a8754590a694171.tar.gz cpython-5c3df35b6b1f48cb48c91b0c7a8754590a694171.tar.bz2 |
The GUI was hanging if the shell window was closed while a raw_input()
was pending. Restored the quit() of the readline() mainloop().
http://mail.python.org/pipermail/idle-dev/2004-December/002307.html
M NEWS.txt
M PyShell.py
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/NEWS.txt | 4 | ||||
-rw-r--r-- | Lib/idlelib/PyShell.py | 18 |
2 files changed, 16 insertions, 6 deletions
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 1e12ca9..4bd5786 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,10 @@ What's New in IDLE 1.2a0? *Release date: XX-XXX-2005* +- The GUI was hanging if the shell window was closed while a raw_input() + was pending. Restored the quit() of the readline() mainloop(). + http://mail.python.org/pipermail/idle-dev/2004-December/002307.html + - The remote procedure call module rpc.py can now access data attributes of remote registered objects. Changes to these attributes are local, however. diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index fae6130..2e55755 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -910,6 +910,9 @@ class PyShell(OutputWindow): parent=self.text) if response == False: return "cancel" + if self.reading: + self.top.quit() + self.canceled = True self.closing = True # Wait for poll_subprocess() rescheduling to stop self.text.after(2 * self.pollinterval, self.close2) @@ -974,10 +977,12 @@ class PyShell(OutputWindow): save = self.reading try: self.reading = 1 - self.top.mainloop() + self.top.mainloop() # nested mainloop() finally: self.reading = save line = self.text.get("iomark", "end-1c") + if len(line) == 0: # may be EOF if we quit our mainloop with Ctrl-C + line = "\n" if isinstance(line, unicode): import IOBinding try: @@ -987,10 +992,11 @@ class PyShell(OutputWindow): self.resetoutput() if self.canceled: self.canceled = 0 - raise KeyboardInterrupt + if not use_subprocess: + raise KeyboardInterrupt if self.endoffile: self.endoffile = 0 - return "" + line = "" return line def isatty(self): @@ -1009,13 +1015,13 @@ class PyShell(OutputWindow): return "break" self.endoffile = 0 self.canceled = 1 - if self.reading: - self.top.quit() - elif (self.executing and self.interp.rpcclt): + if (self.executing and self.interp.rpcclt): if self.interp.getdebugger(): self.interp.restart_subprocess() else: self.interp.interrupt_subprocess() + if self.reading: + self.top.quit() # exit the nested mainloop() in readline() return "break" def eof_callback(self, event): |