(fd, mode="r", buffering=-1, encoding=None, *args, **kwargs)
| 1068 | |
| 1069 | # Supply os.fdopen() |
| 1070 | def fdopen(fd, mode="r", buffering=-1, encoding=None, *args, **kwargs): |
| 1071 | if not isinstance(fd, int): |
| 1072 | raise TypeError("invalid fd type (%s, expected integer)" % type(fd)) |
| 1073 | import io |
| 1074 | if "b" not in mode: |
| 1075 | encoding = io.text_encoding(encoding) |
| 1076 | return io.open(fd, mode, buffering, encoding, *args, **kwargs) |
| 1077 | |
| 1078 | |
| 1079 | # For testing purposes, make sure the function is available when the C |
no test coverage detected