diff options
author | Roger Serwy <roger.serwy@gmail.com> | 2013-06-12 03:13:17 (GMT) |
---|---|---|
committer | Roger Serwy <roger.serwy@gmail.com> | 2013-06-12 03:13:17 (GMT) |
commit | 16ce43a6d8c4f6e0da088c8bc68dbbbdbb2e9a36 (patch) | |
tree | 2b42ca8225d0740a241ec7c0ab130ec56ddc499e /Lib/idlelib/PyShell.py | |
parent | c94f07de7741d7c46be1e0ddeead51679ba305ff (diff) | |
download | cpython-16ce43a6d8c4f6e0da088c8bc68dbbbdbb2e9a36.zip cpython-16ce43a6d8c4f6e0da088c8bc68dbbbdbb2e9a36.tar.gz cpython-16ce43a6d8c4f6e0da088c8bc68dbbbdbb2e9a36.tar.bz2 |
#5492: Avoid traceback when exiting IDLE caused by a race condition.
Diffstat (limited to 'Lib/idlelib/PyShell.py')
-rw-r--r-- | Lib/idlelib/PyShell.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index 0a77bb5..1ae6949 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -370,6 +370,7 @@ class ModifiedInterpreter(InteractiveInterpreter): self.port = PORT self.original_compiler_flags = self.compile.compiler.flags + _afterid = None rpcclt = None rpcpid = None @@ -497,6 +498,8 @@ class ModifiedInterpreter(InteractiveInterpreter): threading.Thread(target=self.__request_interrupt).start() def kill_subprocess(self): + if self._afterid is not None: + self.tkconsole.text.after_cancel(self._afterid) try: self.rpcclt.close() except AttributeError: # no socket @@ -569,8 +572,8 @@ class ModifiedInterpreter(InteractiveInterpreter): pass # Reschedule myself if not self.tkconsole.closing: - self.tkconsole.text.after(self.tkconsole.pollinterval, - self.poll_subprocess) + self._afterid = self.tkconsole.text.after( + self.tkconsole.pollinterval, self.poll_subprocess) debugger = None @@ -987,10 +990,6 @@ class PyShell(OutputWindow): self.stop_readline() self.canceled = 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) def _close(self): |