From: Benjamin Peterson Date: Sun, 12 May 2013 03:24:28 +0000 (-0500) Subject: prevent IDLE from trying to close when sys.stdin is reassigned (#17838) X-Git-Tag: v2.7.5~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5a27168883523adba65b33482f4872d2e5d2e5f9;p=thirdparty%2FPython%2Fcpython.git prevent IDLE from trying to close when sys.stdin is reassigned (#17838) --- diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index e82ebf4c92ae..9cc009fb7b84 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -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) diff --git a/Misc/NEWS b/Misc/NEWS index 624a8afb5778..0405fb99e770 100644 --- 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().