]> git.ipfire.org Git - thirdparty/Python/cpython.git/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 e82ebf4c92ae83050f6ef4b404542f9f8e9eb49a..9cc009fb7b848a430e6f9e007fe0b3095bdc74b8 100644 (file)
@@ -264,6 +264,11 @@ class MyHandler(rpc.RPCHandler):
                 IOBinding.encoding)
         sys.stderr = PyShell.PseudoOutputFile(self.console, "stderr",
                 IOBinding.encoding)
+
+        # 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 624a8afb57780501275bd54fa0e0e437a597517a..0405fb99e7707eaf2cefb4b9deb33d1eae16c1e1 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -122,6 +122,8 @@ Tests
 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().