asyncio: enhance protocol representation

Add "closed" or "closing" to repr() of selector and proactor transports
This commit is contained in:
Victor Stinner 2014-10-12 09:52:11 +02:00
parent fa62f4cedd
commit 0e34dc3737
2 changed files with 13 additions and 2 deletions

View file

@ -467,7 +467,12 @@ class _SelectorTransport(transports._FlowControlMixin,
self._server._attach()
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
if self._loop is not None:
polling = _test_selector_event(self._loop._selector,