Skip to content

Commit be4a3f3

Browse files
Merge pull request RustPython#1514 from alanjds/fix-1132-sys-stdout
`sys.std{in,out,err}` implemented in the most simple way
2 parents 85ae39f + 7d4ab62 commit be4a3f3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Lib/_sitebuiltins.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@
88
# Note this means this module should also avoid keep things alive in its
99
# globals.
1010

11+
import os
1112
import sys
1213

14+
sys.stdin = sys.__stdin__ = getattr(sys, '__stdin__', False) or os.fdopen(0, "r")
15+
sys.stdout = sys.__stdout__ = getattr(sys, '__stdout__', False) or os.fdopen(1, "w")
16+
sys.stderr = sys.__stderr__ = getattr(sys, '__stderr__', False) or os.fdopen(2, "w")
17+
18+
1319
class Quitter(object):
1420
def __init__(self, name, eof):
1521
self.name = name

0 commit comments

Comments
 (0)