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: v3.3.2~7^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0d4931eb9e35a37ea8b116b408082326a80c16c2;p=python 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 d10591246f..88da23ba07 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -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) diff --git a/Misc/NEWS b/Misc/NEWS index 10f00a466c..c76a852f05 100644 --- 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().