(fd, mode="r", buffering=-1, encoding=None, *args, **kwargs)
| 1023 | |
| 1024 | # Supply os.fdopen() |
| 1025 | def fdopen(fd, mode="r", buffering=-1, encoding=None, *args, **kwargs): |
| 1026 | if not isinstance(fd, int): |
| 1027 | raise TypeError("invalid fd type (%s, expected integer)" % type(fd)) |
| 1028 | import io |
| 1029 | if "b" not in mode: |
| 1030 | encoding = io.text_encoding(encoding) |
| 1031 | return io.open(fd, mode, buffering, encoding, *args, **kwargs) |
| 1032 | |
| 1033 | |
| 1034 | # For testing purposes, make sure the function is available when the C |