[Python-checkins] cpython (3.4): asyncio: Fix _ProactorBasePipeTransport.__repr__()

victor.stinner python-checkins at python.org
Thu Jan 15 13:42:38 CET 2015


https://hg.python.org/cpython/rev/063a34c7bf77
changeset:   94171:063a34c7bf77
branch:      3.4
parent:      94169:f9b127188d43
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Jan 15 13:32:28 2015 +0100
summary:
  asyncio: Fix _ProactorBasePipeTransport.__repr__()

Check if the _sock attribute is None to check if the transport is closed.

files:
  Lib/asyncio/proactor_events.py |  6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -43,12 +43,12 @@
 
     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:

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list