mirror of
https://github.com/python/cpython.git
synced 2025-08-28 04:35:02 +00:00
bpo-27456: Simplify sock type checks (#4922)
Recent sock.type fix (see bug 32331) makes sock.type checks simpler in asyncio.
This commit is contained in:
parent
5d8624647d
commit
a7bd64c0c0
3 changed files with 9 additions and 29 deletions
|
@ -222,7 +222,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
|
||||
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 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
|
|||
'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}')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue