mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Extend _close() to break cycles.
Break some other cycles too (and destroy the root when done).
This commit is contained in:
parent
205afb487a
commit
fed9b914b5
1 changed files with 18 additions and 13 deletions
|
|
@ -363,12 +363,13 @@ class PyShell(OutputWindow):
|
||||||
# Helper for ModifiedInterpreter
|
# Helper for ModifiedInterpreter
|
||||||
self.resetoutput()
|
self.resetoutput()
|
||||||
self.executing = 1
|
self.executing = 1
|
||||||
self._cancel_check = self.cancel_check
|
##self._cancel_check = self.cancel_check
|
||||||
##sys.settrace(self._cancel_check)
|
##sys.settrace(self._cancel_check)
|
||||||
|
|
||||||
def endexecuting(self):
|
def endexecuting(self):
|
||||||
# Helper for ModifiedInterpreter
|
# Helper for ModifiedInterpreter
|
||||||
sys.settrace(None)
|
##sys.settrace(None)
|
||||||
|
##self._cancel_check = None
|
||||||
self.executing = 0
|
self.executing = 0
|
||||||
self.canceled = 0
|
self.canceled = 0
|
||||||
|
|
||||||
|
|
@ -386,17 +387,20 @@ class PyShell(OutputWindow):
|
||||||
if self.reading:
|
if self.reading:
|
||||||
self.top.quit()
|
self.top.quit()
|
||||||
return "cancel"
|
return "cancel"
|
||||||
reply = PyShellEditorWindow.close(self)
|
return PyShellEditorWindow.close(self)
|
||||||
if reply != "cancel":
|
|
||||||
self.flist.pyshell = None
|
def _close(self):
|
||||||
# Restore std streams
|
# Restore std streams
|
||||||
sys.stdout = self.save_stdout
|
sys.stdout = self.save_stdout
|
||||||
sys.stderr = self.save_stderr
|
sys.stderr = self.save_stderr
|
||||||
sys.stdin = self.save_stdin
|
sys.stdin = self.save_stdin
|
||||||
# Break cycles
|
# Break cycles
|
||||||
self.interp = None
|
self.interp = None
|
||||||
self.console = None
|
self.console = None
|
||||||
return reply
|
self.auto = None
|
||||||
|
self.flist.pyshell = None
|
||||||
|
self.history = None
|
||||||
|
OutputWindow._close(self) # Really EditorWindow._close
|
||||||
|
|
||||||
def ispythonsource(self, filename):
|
def ispythonsource(self, filename):
|
||||||
# Override this so EditorWindow never removes the colorizer
|
# Override this so EditorWindow never removes the colorizer
|
||||||
|
|
@ -731,6 +735,7 @@ def main():
|
||||||
|
|
||||||
shell.begin()
|
shell.begin()
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
|
root.destroy()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue