From a1a8b7d3d7f628aec31be364c77cbb3e21cdbc0b Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Wed, 9 Nov 2016 15:47:00 -0500 Subject: Issue #28652: Make loop methods reject socket kinds they do not support. --- Lib/asyncio/unix_events.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Lib/asyncio/unix_events.py') diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 65b61db66ac..788a5a09abf 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -235,7 +235,7 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): if sock is None: raise ValueError('no path and sock were specified') if (sock.family != socket.AF_UNIX or - sock.type != socket.SOCK_STREAM): + not base_events._is_stream_socket(sock)): raise ValueError( 'A UNIX Domain Stream Socket was expected, got {!r}' .format(sock)) @@ -289,7 +289,7 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): 'path was not specified, and no sock specified') if (sock.family != socket.AF_UNIX or - sock.type != socket.SOCK_STREAM): + not base_events._is_stream_socket(sock)): raise ValueError( 'A UNIX Domain Stream Socket was expected, got {!r}' .format(sock)) -- cgit v1.2.3