We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9fc40a8 commit df79b11Copy full SHA for df79b11
src/cs50/cs50.py
@@ -28,7 +28,25 @@ def write(self, x):
28
self.f.flush()
29
30
31
+class Reader:
32
+ """
33
+ Disable buffering for input() as well.
34
+
35
+ https://bugs.python.org/issue24402
36
37
38
+ def __getattr__(self, name):
39
+ return getattr(sys.__stdin__, name)
40
41
+ def fileno():
42
+ raise OSError()
43
44
+ def read(self, size):
45
+ return sys.__stdin__.read(size)
46
47
48
sys.stderr = flushfile(sys.stderr)
49
+sys.stdin = Reader()
50
sys.stdout = flushfile(sys.stdout)
51
52
0 commit comments