bpo-27456: Simplify sock type checks (#4922)
Recent sock.type fix (see bug 32331) makes sock.type checks simpler
in asyncio.
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index 50d78c8..2ab6b15 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -222,7 +222,7 @@
if sock is None:
raise ValueError('no path and sock were specified')
if (sock.family != socket.AF_UNIX or
- not base_events._is_stream_socket(sock.type)):
+ sock.type != socket.SOCK_STREAM):
raise ValueError(
f'A UNIX Domain Stream Socket was expected, got {sock!r}')
sock.setblocking(False)
@@ -276,7 +276,7 @@
'path was not specified, and no sock specified')
if (sock.family != socket.AF_UNIX or
- not base_events._is_stream_socket(sock.type)):
+ sock.type != socket.SOCK_STREAM):
raise ValueError(
f'A UNIX Domain Stream Socket was expected, got {sock!r}')