[Python-checkins] cpython (3.5): asyncio: Support host=b'' for getaddrinfo
yury.selivanov
python-checkins at python.org
Thu Jun 2 16:44:19 EDT 2016
https://hg.python.org/cpython/rev/ad7766f342a7
changeset: 101617:ad7766f342a7
branch: 3.5
parent: 101615:17e7d6c4f082
user: Yury Selivanov <yselivanov at sprymix.com>
date: Thu Jun 02 16:43:52 2016 -0400
summary:
asyncio: Support host=b'' for getaddrinfo
files:
Lib/asyncio/base_events.py | 2 +-
Lib/test/test_asyncio/test_base_events.py | 4 ++++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -102,7 +102,7 @@
else:
return None
- if port in {None, ''}:
+ if port in {None, '', b''}:
port = 0
elif isinstance(port, (bytes, str)):
port = int(port)
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -132,6 +132,10 @@
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))
self.assertEqual(
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list