Commit a8f895f0 authored by Yury Selivanov's avatar Yury Selivanov

asyncio: Support host=b'' for getaddrinfo

parent 6a8e626a
......@@ -102,7 +102,7 @@ def _ipaddr_info(host, port, family, type, proto):
else:
return None
if port in {None, ''}:
if port in {None, '', b''}:
port = 0
elif isinstance(port, (bytes, str)):
port = int(port)
......
......@@ -130,6 +130,10 @@ class BaseEventTests(test_utils.TestCase):
(INET, STREAM, TCP, '', ('1.2.3.4', 0)),
base_events._ipaddr_info('1.2.3.4', None, INET, STREAM, TCP))
self.assertEqual(
(INET, STREAM, TCP, '', ('1.2.3.4', 0)),
base_events._ipaddr_info('1.2.3.4', b'', INET, STREAM, TCP))
self.assertEqual(
(INET, STREAM, TCP, '', ('1.2.3.4', 0)),
base_events._ipaddr_info('1.2.3.4', '', INET, STREAM, TCP))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment