diff --git a/tests/test_unix.py b/tests/test_unix.py index 72c81f2..b3b7ee5 100644 --- a/tests/test_unix.py +++ b/tests/test_unix.py @@ -262,7 +262,7 @@ class _TestUnix: run(client) def test_create_unix_connection_4(self): - sock = socket.socket() + sock = socket.socket(socket.AF_UNIX) sock.close() async def client(): diff --git a/uvloop/loop.pyx b/uvloop/loop.pyx index 5bd663b..1c3a256 100644 --- a/uvloop/loop.pyx +++ b/uvloop/loop.pyx @@ -1251,6 +1251,10 @@ cdef class Loop: if sock is None: raise ValueError('no path and sock were specified') + if sock.family != uv.AF_UNIX: + raise ValueError( + 'A UNIX Domain Socket was expected, got {!r}'.format(sock)) + fut = aio_Future(loop=self) protocol = protocol_factory() tr = UVPipeTransport.new(self, protocol, None)