diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-02-20 16:43:09 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-02-20 16:43:09 +0100 |
commit | d1a727a9e5440cdca283719db8fd71c8cb908b35 (patch) | |
tree | 561516e4e66626848a266ff1d26c2d11687d3440 | |
parent | b4c9388947b2c93e3ba7d85e828d8667551a71f6 (diff) | |
download | cpython-git-d1a727a9e5440cdca283719db8fd71c8cb908b35.tar.gz |
asyncio: Fix _check_resolved_address() for IPv6 address
-rw-r--r-- | Lib/asyncio/base_events.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 69caa4d723..1615ecbf42 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -45,10 +45,13 @@ def _check_resolved_address(sock, address): # Ensure that the address is already resolved to avoid the trap of hanging # the entire event loop when the address requires doing a DNS lookup. family = sock.family - if family not in (socket.AF_INET, socket.AF_INET6): + if family == socket.AF_INET: + host, port = address + elif family == socket.AF_INET6: + host, port, flow_info, scope_id = address + else: return - host, port = address type_mask = 0 if hasattr(socket, 'SOCK_NONBLOCK'): type_mask |= socket.SOCK_NONBLOCK |