mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
asyncio: enhance protocol representation
Add "closed" or "closing" to repr() of selector and proactor transports
This commit is contained in:
parent
fa62f4cedd
commit
0e34dc3737
2 changed files with 13 additions and 2 deletions
|
@ -42,7 +42,13 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin,
|
||||||
self._loop.call_soon(waiter._set_result_unless_cancelled, None)
|
self._loop.call_soon(waiter._set_result_unless_cancelled, None)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
info = [self.__class__.__name__, 'fd=%s' % self._sock.fileno()]
|
info = [self.__class__.__name__]
|
||||||
|
fd = self._sock.fileno()
|
||||||
|
if fd < 0:
|
||||||
|
info.append('closed')
|
||||||
|
elif self._closing:
|
||||||
|
info.append('closing')
|
||||||
|
info.append('fd=%s' % fd)
|
||||||
if self._read_fut is not None:
|
if self._read_fut is not None:
|
||||||
info.append('read=%s' % self._read_fut)
|
info.append('read=%s' % self._read_fut)
|
||||||
if self._write_fut is not None:
|
if self._write_fut is not None:
|
||||||
|
|
|
@ -467,7 +467,12 @@ class _SelectorTransport(transports._FlowControlMixin,
|
||||||
self._server._attach()
|
self._server._attach()
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
info = [self.__class__.__name__, 'fd=%s' % self._sock_fd]
|
info = [self.__class__.__name__]
|
||||||
|
if self._sock is None:
|
||||||
|
info.append('closed')
|
||||||
|
elif self._closing:
|
||||||
|
info.append('closing')
|
||||||
|
info.append('fd=%s' % self._sock_fd)
|
||||||
# test if the transport was closed
|
# test if the transport was closed
|
||||||
if self._loop is not None:
|
if self._loop is not None:
|
||||||
polling = _test_selector_event(self._loop._selector,
|
polling = _test_selector_event(self._loop._selector,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue