[Python-checkins] cpython (3.3): prevent IDLE from trying to close when sys.stdin is reassigned (#17838)

georg.brandl python-checkins at python.org
Sun May 12 11:24:19 CEST 2013


http://hg.python.org/cpython/rev/5f62c848f713
changeset:   83728:5f62c848f713
branch:      3.3
parent:      83576:4e58cafbebfc
user:        Benjamin Peterson <benjamin at python.org>
date:        Sat May 11 22:24:28 2013 -0500
summary:
  prevent IDLE from trying to close when sys.stdin is reassigned (#17838)

files:
  Lib/idlelib/run.py |  5 +++++
  Misc/NEWS          |  2 ++
  2 files changed, 7 insertions(+), 0 deletions(-)


diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -297,6 +297,11 @@
         # page help() text to shell.
         import pydoc # import must be done here to capture i/o binding
         pydoc.pager = pydoc.plainpager
+
+        # Keep a reference to stdin so that it won't try to exit IDLE if
+        # sys.stdin gets changed from within IDLE's shell. See issue17838.
+        self._keep_stdin = sys.stdin
+
         self.interp = self.get_remote_proxy("interp")
         rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05)
 
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -118,6 +118,8 @@
 IDLE
 ----
 
+- Issue #17838: Allow sys.stdin to be reassigned.
+
 - Issue #14735: Update IDLE docs to omit "Control-z on Windows".
 
 - Issue #17585: Fixed IDLE regression. Now closes when using exit() or quit().

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list