[issue17838] Can't assign a different value for sys.stdin in IDLE

Roger Serwy report at bugs.python.org
Fri Apr 26 16:25:03 CEST 2013


Roger Serwy added the comment:

If we remove .close() then we'll need to then have an alternative way to allow "exit()" and "quit()" to actually close IDLE. The RPC proxy already transfers exceptions between the subprocess and the front-end, so we could catch the SystemExit exception and handle it by calling close(). That's perfectably doable, and likely the right way to do it. If anyone wants to write that patch, I'll gladly offer guidance if necessary.

Here's a dirty hack that also solves the issue. Garbage collection on the PseudoInputFile for sys.stdin calls .close(). As long as we hold an extra reference to it, it won't close. The attached patch holds an extra reference to sys.stdin in Lib/idlelib/run.py.

----------
keywords: +patch
Added file: http://bugs.python.org/file30027/hold_stdin.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17838>
_______________________________________


More information about the Python-bugs-list mailing list