by sigjuice · 6y ago · 0 comments
import sys, threading
def r():
sys.stdin.buffer.read(1)
t = threading.Thread(target=r, daemon=True)
t.start() import sys, threading, time
t = threading.Thread(target=sys.stdin.read, args=(1,))
t.start()
time.sleep(1)
sys.stdin.close()
Run it then after a few seconds press enter. It doesn't segfault in Python 3, but it still doesn't behave how I'd like, because I would like the close() to unblock the read(), but it doesn't unblock the read(), the read() still hangs until it gets some input.I wouldn't have bothered filing the bug.