1.1 --- a/lib/__builtins__/__init__.py Tue Dec 06 20:32:33 2016 +0100
1.2 +++ b/lib/__builtins__/__init__.py Tue Dec 06 20:35:50 2016 +0100
1.3 @@ -90,7 +90,7 @@
1.4 from __builtins__.character import chr, hex, oct, ord, unichr
1.5 from __builtins__.comparable import cmp, hash
1.6 from __builtins__.identity import callable, help, id, isinstance, issubclass, repr
1.7 -from __builtins__.io import open, raw_input, print_, sysfile
1.8 +from __builtins__.io import open, raw_input, print_
1.9 from __builtins__.iterable import all, any, enumerate, filter, iter, len, map, max, min, reduce, reversed, sorted, sum, zip
1.10 from __builtins__.namespace import dir, globals, locals, vars
1.11 from __builtins__.numeric import abs, divmod, pow, round
2.1 --- a/lib/__builtins__/io.py Tue Dec 06 20:32:33 2016 +0100
2.2 +++ b/lib/__builtins__/io.py Tue Dec 06 20:35:50 2016 +0100
2.3 @@ -19,30 +19,6 @@
2.4 this program. If not, see <http://www.gnu.org/licenses/>.
2.5 """
2.6
2.7 -from posix.io import fdopen, read, write
2.8 -
2.9 -class sysfile:
2.10 -
2.11 - "A system-level file object."
2.12 -
2.13 - def __init__(self, fd):
2.14 -
2.15 - "Initialise the file with the given 'fd'."
2.16 -
2.17 - self.fd = fd
2.18 -
2.19 - def read(self, n):
2.20 -
2.21 - "Read 'n' bytes from the file."
2.22 -
2.23 - return read(self.fd, n)
2.24 -
2.25 - def write(self, s):
2.26 -
2.27 - "Write 's' to the file."
2.28 -
2.29 - write(self.fd, str(s))
2.30 -
2.31 def open(name, mode=None, buffering=None):
2.32
2.33 """
3.1 --- a/lib/posix/io.py Tue Dec 06 20:32:33 2016 +0100
3.2 +++ b/lib/posix/io.py Tue Dec 06 20:35:50 2016 +0100
3.3 @@ -21,6 +21,28 @@
3.4
3.5 import native
3.6
3.7 +class sysfile:
3.8 +
3.9 + "A system-level file object."
3.10 +
3.11 + def __init__(self, fd):
3.12 +
3.13 + "Initialise the file with the given 'fd'."
3.14 +
3.15 + self.fd = fd
3.16 +
3.17 + def read(self, n):
3.18 +
3.19 + "Read 'n' bytes from the file."
3.20 +
3.21 + return read(self.fd, n)
3.22 +
3.23 + def write(self, s):
3.24 +
3.25 + "Write 's' to the file."
3.26 +
3.27 + write(self.fd, str(s))
3.28 +
3.29 def close(fd): pass
3.30 def closerange(fd_low, fd_high): pass
3.31 def dup(fd): pass
4.1 --- a/lib/sys.py Tue Dec 06 20:32:33 2016 +0100
4.2 +++ b/lib/sys.py Tue Dec 06 20:35:50 2016 +0100
4.3 @@ -20,6 +20,7 @@
4.4 """
4.5
4.6 from __builtins__.int import maxint, minint
4.7 +from posix.io import sysfile
4.8 import native
4.9
4.10 # Standard streams.