diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index c66679cde92..5283a93b808 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 22e038b51e9..4c88a540647 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -294,6 +294,8 @@ C-API IDLE ---- +- Issue #17838: Allow sys.stdin to be reassigned. + - Issue #13495: Avoid loading the color delegator twice in IDLE. - Issue #17798: Allow IDLE to edit new files when specified on command line.