◐ Shell
clean mode source ↗

Message 38868 - Python tracker

Logged In: YES 
user_id=21627

I think you should implement a strategy to detect changes to
sys.stdin dynamically. For example, the old sys.stdin could
go away, closing the file, which would leave readline with a
garbage pointer.

Instead, I think you should hold onto sys.stdin, and compare
this reference from time to time with the current sys.stdin,
and arrange to reinitialize readline (if possible).