The file system encoding must ensure that everything is successfully decoded to 128 bytes or less. If the file system encoding does not guarantee this, the API function raises a UnicodeError.
Connects to file descriptor fd and returns an open file object. This is an alias for the built-in function open () and takes the same arguments. The only difference is that the first argument to fdopen () must always be an integer.
# py/cpython/blob/master/Lib/os.py
# Supply os.fdopen()
def fdopen(fd, *args, **kwargs):
if not isinstance(fd, int):
raise TypeError("invalid fd type (%s, expected integer)" % type(fd))
import io
return io.open(fd, *args, **kwargs)