summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/unix_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-01-25 14:32:06 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-01-25 14:32:06 (GMT)
commit8dffc456d74a3a4395ac7a8f3957ff74f7f66753 (patch)
treee6a0b0a8ceaea275bfba7276698842f3a0ab5d79 /Lib/asyncio/unix_events.py
parent75a5ec88ff41ad7d3909e54ce517754298b31404 (diff)
downloadcpython-8dffc456d74a3a4395ac7a8f3957ff74f7f66753.zip
cpython-8dffc456d74a3a4395ac7a8f3957ff74f7f66753.tar.gz
cpython-8dffc456d74a3a4395ac7a8f3957ff74f7f66753.tar.bz2
Update asyncio from the Tulip project
Major changes: - StreamReader.readexactly() now raises an IncompleteReadError if the end of stream is reached before we received enough bytes, instead of returning less bytes than requested. - Unit tests use the main asyncio module instead of submodules like events - _UnixWritePipeTransport now also supports character devices, as _UnixReadPipeTransport. Patch written by Jonathan Slenders. - Export more symbols: BaseEventLoop, BaseProactorEventLoop, BaseSelectorEventLoop, Queue and Queue sublasses, Empty, Full
Diffstat (limited to 'Lib/asyncio/unix_events.py')
-rw-r--r--Lib/asyncio/unix_events.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index 24da327..7a6546d 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -259,9 +259,11 @@ class _UnixWritePipeTransport(transports.WriteTransport):
self._fileno = pipe.fileno()
mode = os.fstat(self._fileno).st_mode
is_socket = stat.S_ISSOCK(mode)
- is_pipe = stat.S_ISFIFO(mode)
- if not (is_socket or is_pipe):
- raise ValueError("Pipe transport is for pipes/sockets only.")
+ if not (is_socket or
+ stat.S_ISFIFO(mode) or
+ stat.S_ISCHR(mode)):
+ raise ValueError("Pipe transport is only for "
+ "pipes, sockets and character devices")
_set_nonblocking(self._fileno)
self._protocol = protocol
self._buffer = []