diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 3748da6e260..4e6be9f7051 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -139,6 +139,8 @@ def _ipaddr_info(host, port, family, type, proto, flowinfo=0, scopeid=0): if isinstance(host, bytes): host = host.decode('idna') + # Even though we're calling str() on host (so we'll convert arbitrary objects to str), + # we're restricting it to a valid IP address later when calling socket.inet_pton(). host = str(host) if '%' in host: # Linux's inet_pton doesn't accept an IPv6 zone index after host,