8000 bpo-27929: resolve names only for AF_INET/AF_INET6 with asyncio (GH-3… · python/cpython@5c30388 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c30388

Browse files
bpo-27929: resolve names only for AF_INET/AF_INET6 with asyncio (GH-32131)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
1 parent 7b44ade commit 5c30388

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Lib/asyncio/selector_events.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,8 @@ async def sock_connect(self, sock, address):
620620
if self._debug and sock.gettimeout() != 0:
621621
raise ValueError("the socket must be non-blocking")
622622

623-
if not hasattr(socket, 'AF_UNIX') or sock.family != socket.AF_UNIX:
623+
if sock.family == socket.AF_INET or (
624+
base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
624625
resolved = await self._ensure_resolved(
625626
address, family=sock.family, type=sock.type, proto=sock.proto,
626627
loop=self,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix :meth:`asyncio.loop.sock_connect` to only resolve names for :const:`socket.AF_INET` or
2+
:const:`socket.AF_INET6` families. Resolution may not make sense for other families,
3+
like :const:`socket.AF_BLUETOOTH` and :const:`socket.AF_UNIX`.

0 commit comments

Comments
 (0)
0