summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2016-08-31 16:40:18 (GMT)
committerGuido van Rossum <guido@python.org>2016-08-31 16:40:18 (GMT)
commit8b7918a7e29b9043d6ed57e2ea799febaf2b9cc8 (patch)
tree53914f214b9ebcbbf2a27f9f926d0129f2b6412f /Lib/asyncio
parent09c22adadfd90b2d85778c9f835c5ce122f529a3 (diff)
downloadcpython-8b7918a7e29b9043d6ed57e2ea799febaf2b9cc8.zip
cpython-8b7918a7e29b9043d6ed57e2ea799febaf2b9cc8.tar.gz
cpython-8b7918a7e29b9043d6ed57e2ea799febaf2b9cc8.tar.bz2
Don't select for read on character devices in _UnixWritePipeTransport.
Upstream https://github.com/python/asyncio/pull/374 by Ron Frederick.
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/unix_events.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index d712749..f04d514 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -422,10 +422,10 @@ class _UnixWritePipeTransport(transports._FlowControlMixin,
self._pipe = pipe
self._fileno = pipe.fileno()
mode = os.fstat(self._fileno).st_mode
+ is_char = stat.S_ISCHR(mode)
+ is_fifo = stat.S_ISFIFO(mode)
is_socket = stat.S_ISSOCK(mode)
- if not (is_socket or
- stat.S_ISFIFO(mode) or
- stat.S_ISCHR(mode)):
+ if not (is_char or is_fifo or is_socket):
raise ValueError("Pipe transport is only for "
"pipes, sockets and character devices")
_set_nonblocking(self._fileno)
@@ -439,7 +439,7 @@ class _UnixWritePipeTransport(transports._FlowControlMixin,
# On AIX, the reader trick (to be notified when the read end of the
# socket is closed) only works for sockets. On other platforms it
# works for pipes and sockets. (Exception: OS X 10.4? Issue #19294.)
- if is_socket or not sys.platform.startswith("aix"):
+ if is_socket or (is_fifo and not sys.platform.startswith("aix")):
# only start reading when connection_made() has been called
self._loop.call_soon(self._loop.add_reader,
self._fileno, self._read_ready)