#5492: Avoid traceback when exiting IDLE caused by a race condition.

This commit is contained in:
Roger Serwy 2013-06-11 22:13:17 -05:00
parent c94f07de77
commit 16ce43a6d8
2 changed files with 7 additions and 6 deletions

View File

@ -370,6 +370,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
self.port = PORT self.port = PORT
self.original_compiler_flags = self.compile.compiler.flags self.original_compiler_flags = self.compile.compiler.flags
_afterid = None
rpcclt = None rpcclt = None
rpcpid = None rpcpid = None
@ -497,6 +498,8 @@ class ModifiedInterpreter(InteractiveInterpreter):
threading.Thread(target=self.__request_interrupt).start() threading.Thread(target=self.__request_interrupt).start()
def kill_subprocess(self): def kill_subprocess(self):
if self._afterid is not None:
self.tkconsole.text.after_cancel(self._afterid)
try: try:
self.rpcclt.close() self.rpcclt.close()
except AttributeError: # no socket except AttributeError: # no socket
@ -569,8 +572,8 @@ class ModifiedInterpreter(InteractiveInterpreter):
pass pass
# Reschedule myself # Reschedule myself
if not self.tkconsole.closing: if not self.tkconsole.closing:
self.tkconsole.text.after(self.tkconsole.pollinterval, self._afterid = self.tkconsole.text.after(
self.poll_subprocess) self.tkconsole.pollinterval, self.poll_subprocess)
debugger = None debugger = None
@ -987,10 +990,6 @@ class PyShell(OutputWindow):
self.stop_readline() self.stop_readline()
self.canceled = True self.canceled = True
self.closing = True self.closing = True
# Wait for poll_subprocess() rescheduling to stop
self.text.after(2 * self.pollinterval, self.close2)
def close2(self):
return EditorWindow.close(self) return EditorWindow.close(self)
def _close(self): def _close(self):

View File

@ -50,6 +50,8 @@ Build
IDLE IDLE
---- ----
- Issue #5492: Avoid traceback when exiting IDLE caused by a race condition.
- Issue #17511: Keep IDLE find dialog open after clicking "Find Next". - Issue #17511: Keep IDLE find dialog open after clicking "Find Next".
Original patch by Sarah K. Original patch by Sarah K.