Skip to content

Commit 0c2c6c1

Browse files
authoredNov 1, 2018
Merge pull request #59 from cs50/idle
maintaining original sys.stdin
2 parents d03d296 + 3b72eec commit 0c2c6c1

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed
 

‎setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
package_dir={"": "src"},
1717
packages=["cs50"],
1818
url="https://github.com/cs50/python-cs50",
19-
version="2.4.2"
19+
version="2.4.3"
2020
)

‎src/cs50/cs50.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,21 @@ class Reader:
3535
https://bugs.python.org/issue24402
3636
"""
3737

38+
def __init__(self, f):
39+
self.f = f
40+
3841
def __getattr__(self, name):
39-
return getattr(sys.__stdin__, name)
42+
return getattr(self.f, name)
4043

4144
def fileno():
4245
raise OSError()
4346

4447
def read(self, size):
45-
return sys.__stdin__.read(size)
48+
return self.f.read(size)
4649

4750

4851
sys.stderr = flushfile(sys.stderr)
49-
sys.stdin = Reader()
52+
sys.stdin = Reader(sys.stdin)
5053
sys.stdout = flushfile(sys.stdout)
5154

5255

0 commit comments

Comments
 (0)
Please sign in to comment.