| 1629 | """ |
| 1630 | |
| 1631 | def __init__(self, fd: int, *args: Any, **kwargs: Any) -> None: |
| 1632 | self.fd = fd |
| 1633 | self._fio = io.FileIO(self.fd, "r+") |
| 1634 | if sys.platform == "win32": |
| 1635 | # The form and placement of this assertion is important to mypy. |
| 1636 | # A plain assert statement isn't recognized here. If the assertion |
| 1637 | # were earlier it would worry that the attributes of self aren't |
| 1638 | # set on windows. If it were missing it would complain about |
| 1639 | # the absence of the set_blocking function. |
| 1640 | raise AssertionError("PipeIOStream is not supported on Windows") |
| 1641 | os.set_blocking(fd, False) |
| 1642 | super().__init__(*args, **kwargs) |
| 1643 | |
| 1644 | def fileno(self) -> int: |
| 1645 | return self.fd |