Method
close_fd
(self, fd: Union[int, _Selectable])
Source from the content-addressed store, hash-verified
| 786 | return fd.fileno(), fd |
| 787 | |
| 788 | def close_fd(self, fd: Union[int, _Selectable]) -> None: |
| 789 | # """Utility method to close an ``fd``. |
| 790 | |
| 791 | # If ``fd`` is a file-like object, we close it directly; otherwise |
| 792 | # we use `os.close`. |
| 793 | |
| 794 | # This method is provided for use by `IOLoop` subclasses (in |
| 795 | # implementations of ``IOLoop.close(all_fds=True)`` and should |
| 796 | # not generally be used by application code. |
| 797 | |
| 798 | # .. versionadded:: 4.0 |
| 799 | # """ |
| 800 | try: |
| 801 | if isinstance(fd, int): |
| 802 | os.close(fd) |
| 803 | else: |
| 804 | fd.close() |
| 805 | except OSError: |
| 806 | pass |
| 807 | |
| 808 | |
| 809 | class _Timeout(object): |
Tested by
no test coverage detected