]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
The GUI was hanging if the shell window was closed while a raw_input()
authorKurt B. Kaiser <kbk@shore.net>
Thu, 23 Dec 2004 04:32:25 +0000 (04:32 +0000)
committerKurt B. Kaiser <kbk@shore.net>
Thu, 23 Dec 2004 04:32:25 +0000 (04:32 +0000)
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
M idlever.py

Lib/idlelib/NEWS.txt
Lib/idlelib/PyShell.py
Lib/idlelib/idlever.py

index 6337e7ca85009637a92ab55b55426d33501aa57b..86a604066a9f1134c67224a50bafcc9b0e389526 100644 (file)
@@ -1,3 +1,12 @@
+What's New in IDLE 1.1.1?
+=======================
+
+*Release date: XX-DEC-2004*
+
+- 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
+
 What's New in IDLE 1.1?
 =======================
 
index 887d63804c4fa4e0d8f5833e182cfde50097d68b..387b5375620f4a2a1eb8f546ec2a6c906042c571 100644 (file)
@@ -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):
index aba89af82a9b7ffee928d4e413f99f734ca0e46b..46b58aa42d8dbf916a7553747900726a4fbfcbee 100644 (file)
@@ -1 +1 @@
-IDLE_VERSION = "1.1"
+IDLE_VERSION = "1.1.1"