summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2016-05-13 20:04:43 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2016-05-13 20:04:43 (GMT)
commit5dc093336f6f6c7bd0b79c1c870dc9b733fc2fe5 (patch)
treef38afabb73279f9c26d2fbebd12bfcd5a164bffd /Lib/asyncio
parent32dae3d50ff8f3ab5cbb36df476844ed41deb103 (diff)
downloadcpython-5dc093336f6f6c7bd0b79c1c870dc9b733fc2fe5.zip
cpython-5dc093336f6f6c7bd0b79c1c870dc9b733fc2fe5.tar.gz
cpython-5dc093336f6f6c7bd0b79c1c870dc9b733fc2fe5.tar.bz2
asyncio: Fix unix pipe transport 'repr' methods
Patch by Vincent Michel. See also https://github.com/python/asyncio/pull/326
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/unix_events.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index 46686a0..b62dd38 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -329,14 +329,17 @@ class _UnixReadPipeTransport(transports.ReadTransport):
elif self._closing:
info.append('closing')
info.append('fd=%s' % self._fileno)
- if self._pipe is not None:
+ selector = getattr(self._loop, '_selector', None)
+ if self._pipe is not None and selector is not None:
polling = selector_events._test_selector_event(
- self._loop._selector,
+ selector,
self._fileno, selectors.EVENT_READ)
if polling:
info.append('polling')
else:
info.append('idle')
+ elif self._pipe is not None:
+ info.append('open')
else:
info.append('closed')
return '<%s>' % ' '.join(info)
@@ -453,9 +456,10 @@ class _UnixWritePipeTransport(transports._FlowControlMixin,
elif self._closing:
info.append('closing')
info.append('fd=%s' % self._fileno)
- if self._pipe is not None:
+ selector = getattr(self._loop, '_selector', None)
+ if self._pipe is not None and selector is not None:
polling = selector_events._test_selector_event(
- self._loop._selector,
+ selector,
self._fileno, selectors.EVENT_WRITE)
if polling:
info.append('polling')
@@ -464,6 +468,8 @@ class _UnixWritePipeTransport(transports._FlowControlMixin,
bufsize = self.get_write_buffer_size()
info.append('bufsize=%s' % bufsize)
+ elif self._pipe is not None:
+ info.append('open')
else:
info.append('closed')
return '<%s>' % ' '.join(info)