loop: Make create_unix_connection accept only UNIX sockets

This commit is contained in:
Yury Selivanov 2016-04-12 23:13:19 -04:00
parent 81d782bc33
commit c9d4bf9cdf
2 changed files with 5 additions and 1 deletions

View File

@ -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():

View File

@ -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)