diff options
Diffstat (limited to 'Lib/asyncio')
-rw-r--r-- | Lib/asyncio/base_events.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 4aac4ac..23dfef4 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -102,6 +102,11 @@ def _ipaddr_info(host, port, family, type, proto): else: return None + if port in {None, ''}: + port = 0 + elif isinstance(port, (bytes, str)): + port = int(port) + if hasattr(socket, 'inet_pton'): if family == socket.AF_UNSPEC: afs = [socket.AF_INET, socket.AF_INET6] |