summaryrefslogtreecommitdiffstats
path: root/Tools/idle/PyShell.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-06-25 16:09:27 (GMT)
committerGuido van Rossum <guido@python.org>1999-06-25 16:09:27 (GMT)
commitfed9b914b5469ba36c30c0e6ab9cde441c2431a9 (patch)
treecbb57381caad9de90116597003e304816151d772 /Tools/idle/PyShell.py
parent205afb487a4ed9a70b0360da47402d2409aa9ed1 (diff)
downloadcpython-fed9b914b5469ba36c30c0e6ab9cde441c2431a9.zip
cpython-fed9b914b5469ba36c30c0e6ab9cde441c2431a9.tar.gz
cpython-fed9b914b5469ba36c30c0e6ab9cde441c2431a9.tar.bz2
Extend _close() to break cycles.
Break some other cycles too (and destroy the root when done).
Diffstat (limited to 'Tools/idle/PyShell.py')
-rw-r--r--Tools/idle/PyShell.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/Tools/idle/PyShell.py b/Tools/idle/PyShell.py
index a618ad1..90f9b2c 100644
--- a/Tools/idle/PyShell.py
+++ b/Tools/idle/PyShell.py
@@ -363,12 +363,13 @@ class PyShell(OutputWindow):
# Helper for ModifiedInterpreter
self.resetoutput()
self.executing = 1
- self._cancel_check = self.cancel_check
+ ##self._cancel_check = self.cancel_check
##sys.settrace(self._cancel_check)
def endexecuting(self):
# Helper for ModifiedInterpreter
- sys.settrace(None)
+ ##sys.settrace(None)
+ ##self._cancel_check = None
self.executing = 0
self.canceled = 0
@@ -386,17 +387,20 @@ class PyShell(OutputWindow):
if self.reading:
self.top.quit()
return "cancel"
- reply = PyShellEditorWindow.close(self)
- if reply != "cancel":
- self.flist.pyshell = None
- # Restore std streams
- sys.stdout = self.save_stdout
- sys.stderr = self.save_stderr
- sys.stdin = self.save_stdin
- # Break cycles
- self.interp = None
- self.console = None
- return reply
+ return PyShellEditorWindow.close(self)
+
+ def _close(self):
+ # Restore std streams
+ sys.stdout = self.save_stdout
+ sys.stderr = self.save_stderr
+ sys.stdin = self.save_stdin
+ # Break cycles
+ self.interp = None
+ self.console = None
+ self.auto = None
+ self.flist.pyshell = None
+ self.history = None
+ OutputWindow._close(self) # Really EditorWindow._close
def ispythonsource(self, filename):
# Override this so EditorWindow never removes the colorizer
@@ -731,6 +735,7 @@ def main():
shell.begin()
root.mainloop()
+ root.destroy()
if __name__ == "__main__":