Skip to content

Commit 557d515

Browse files
committed
_check_resolved_address() must also accept IPv6 without flow_info and scope_id:
(host, port).
1 parent 228cf17 commit 557d515

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

asyncio/base_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def _check_resolved_address(sock, address):
4848
if family == socket.AF_INET:
4949
host, port = address
5050
elif family == socket.AF_INET6:
51-
host, port, flow_info, scope_id = address
51+
host, port = address[:2]
5252
else:
5353
return
5454

tests/test_events.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,11 +1335,14 @@ def wait():
13351335
'selector': self.loop._selector.__class__.__name__})
13361336

13371337
def test_sock_connect_address(self):
1338-
families = [(socket.AF_INET, ('www.python.org', 80))]
1338+
addresses = [(socket.AF_INET, ('www.python.org', 80))]
13391339
if support.IPV6_ENABLED:
1340-
families.append((socket.AF_INET6, ('www.python.org', 80, 0, 0)))
1340+
addresses.extend((
1341+
(socket.AF_INET6, ('www.python.org', 80)),
1342+
(socket.AF_INET6, ('www.python.org', 80, 0, 0)),
1343+
))
13411344

1342-
for family, address in families:
1345+
for family, address in addresses:
13431346
for sock_type in (socket.SOCK_STREAM, socket.SOCK_DGRAM):
13441347
sock = socket.socket(family, sock_type)
13451348
with sock:

0 commit comments

Comments
 (0)