]> granicus.if.org Git - python/commitdiff
prevent IDLE from trying to close when sys.stdin is reassigned (#17838)
authorBenjamin Peterson <benjamin@python.org>
Sun, 12 May 2013 03:24:28 +0000 (22:24 -0500)
committerBenjamin Peterson <benjamin@python.org>
Sun, 12 May 2013 03:24:28 +0000 (22:24 -0500)
Lib/idlelib/run.py
Misc/NEWS

index d10591246fd823d0a9ef9ef96b1008dc3b0564f7..88da23ba0721d940b407d47a9b5e699cbeb062f5 100644 (file)
@@ -297,6 +297,11 @@ class MyHandler(rpc.RPCHandler):
         # 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)
 
index 10f00a466c14b9c4693b67ebd8e9472a50850e93..c76a852f0504212ec91a0fcc8256babb66348441 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -118,6 +118,8 @@ Library
 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().