summaryrefslogtreecommitdiff
path: root/Lib/asyncio/unix_events.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-10-07 12:40:22 -0400
committerYury Selivanov <yury@magic.io>2016-10-07 12:40:22 -0400
commit3df053e556c27dd8ed8fd20e1f1d652284132ff1 (patch)
tree5272dead33a17d0c524c274600fa64b9495d74ff /Lib/asyncio/unix_events.py
parentac5084b6c760ff5e6469854373fe6c3c81804f87 (diff)
parent36e7e97d621863e6e3e3baeb22909ec06e720639 (diff)
downloadcpython-git-3df053e556c27dd8ed8fd20e1f1d652284132ff1.tar.gz
Merge 3.5 (asyncio)
Diffstat (limited to 'Lib/asyncio/unix_events.py')
-rw-r--r--Lib/asyncio/unix_events.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index b227ee0978..8524ba9eaf 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -234,6 +234,11 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
else:
if sock is None:
raise ValueError('no path and sock were specified')
+ if (sock.family != socket.AF_UNIX or
+ sock.type != socket.SOCK_STREAM):
+ raise ValueError(
+ 'A UNIX Domain Stream Socket was expected, got {!r}'
+ .format(sock))
sock.setblocking(False)
transport, protocol = yield from self._create_connection_transport(
@@ -272,9 +277,11 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
raise ValueError(
'path was not specified, and no sock specified')
- if sock.family != socket.AF_UNIX:
+ if (sock.family != socket.AF_UNIX or
+ sock.type != socket.SOCK_STREAM):
raise ValueError(
- 'A UNIX Domain Socket was expected, got {!r}'.format(sock))
+ 'A UNIX Domain Stream Socket was expected, got {!r}'
+ .format(sock))
server = base_events.Server(self, [sock])
sock.listen(backlog)