[Python-checkins] cpython (merge 3.5 -> default): Merge 3.5 (asyncio)

yury.selivanov python-checkins at python.org
Tue Jun 28 11:01:46 EDT 2016


https://hg.python.org/cpython/rev/d96c8b1154da
changeset:   102223:d96c8b1154da
parent:      102221:a9b4da316283
parent:      102222:e6525c6ad789
user:        Yury Selivanov <yury at magic.io>
date:        Tue Jun 28 11:00:39 2016 -0400
summary:
  Merge 3.5 (asyncio)

files:
  Lib/asyncio/selector_events.py                |   3 +-
  Lib/test/test_asyncio/test_selector_events.py |  11 ++++++++++
  2 files changed, 13 insertions(+), 1 deletions(-)


diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -394,7 +394,8 @@
         if hasattr(socket, 'AF_UNIX') and sock.family == socket.AF_UNIX:
             self._sock_connect(fut, sock, address)
         else:
-            resolved = base_events._ensure_resolved(address, loop=self)
+            resolved = base_events._ensure_resolved(
+                address, family=sock.family, proto=sock.proto, loop=self)
             resolved.add_done_callback(
                 lambda resolved: self._on_resolved(fut, sock, resolved))
 
diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py
--- a/Lib/test/test_asyncio/test_selector_events.py
+++ b/Lib/test/test_asyncio/test_selector_events.py
@@ -373,6 +373,17 @@
             self.loop.run_until_complete(fut)
         self.assertTrue(self.loop.remove_writer.called)
 
+    def test_sock_connect_resolve_using_socket_params(self):
+        addr = ('need-resolution.com', 8080)
+        sock = test_utils.mock_nonblocking_socket()
+        self.loop.getaddrinfo = mock.Mock()
+        self.loop.sock_connect(sock, addr)
+        while not self.loop.getaddrinfo.called:
+            self.loop._run_once()
+        self.loop.getaddrinfo.assert_called_with(
+            *addr, type=sock.type, family=sock.family, proto=sock.proto,
+            flags=0)
+
     def test__sock_connect(self):
         f = asyncio.Future(loop=self.loop)
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list