summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-01-15 12:32:28 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-01-15 12:32:28 (GMT)
commit79c93ba47b1bd638989c60726eb6d9467c47308c (patch)
tree8eace3672021b1f50a534118604f2739543a90bd /Lib/asyncio
parent02392c92820d8633ccf906e8c3d0fdb2fe16e5ba (diff)
downloadcpython-79c93ba47b1bd638989c60726eb6d9467c47308c.zip
cpython-79c93ba47b1bd638989c60726eb6d9467c47308c.tar.gz
cpython-79c93ba47b1bd638989c60726eb6d9467c47308c.tar.bz2
asyncio: Fix _ProactorBasePipeTransport.__repr__()
Check if the _sock attribute is None to check if the transport is closed.
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/proactor_events.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index 0ecb44e..a177d32 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -43,12 +43,12 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin,
def __repr__(self):
info = [self.__class__.__name__]
- fd = self._sock.fileno()
- if fd < 0:
+ if self._sock is None:
info.append('closed')
elif self._closing:
info.append('closing')
- info.append('fd=%s' % fd)
+ if self._sock is not None:
+ info.append('fd=%s' % self._sock.fileno())
if self._read_fut is not None:
info.append('read=%s' % self._read_fut)
if self._write_fut is not None: