aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/asyncio/proactor_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-02-13 09:24:37 +0100
committerVictor Stinner <victor.stinner@gmail.com>2014-02-13 09:24:37 +0100
commit1b0580b3203281e700ab3df10e6d117796f9d955 (patch)
tree1f6d56d1d8b275d73c08e0824da2a4ee017db449 /Lib/asyncio/proactor_events.py
parent2303fecedcfbdec16999e054e401dfad3a13fc05 (diff)
downloadcpython-1b0580b3203281e700ab3df10e6d117796f9d955.tar.gz
cpython-1b0580b3203281e700ab3df10e6d117796f9d955.zip
ayncio, Tulip issue 129: BaseEventLoop.sock_connect() now raises an error if
the address is not resolved (hostname instead of an IP address) for AF_INET and AF_INET6 address families.
Diffstat (limited to 'Lib/asyncio/proactor_events.py')
-rw-r--r--Lib/asyncio/proactor_events.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index 74566b2ec9b..5de4d3d691a 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -404,7 +404,14 @@ class BaseProactorEventLoop(base_events.BaseEventLoop):
return self._proactor.send(sock, data)
def sock_connect(self, sock, address):
- return self._proactor.connect(sock, address)
+ try:
+ base_events._check_resolved_address(sock, address)
+ except ValueError as err:
+ fut = futures.Future(loop=self)
+ fut.set_exception(err)
+ return fut
+ else:
+ return self._proactor.connect(sock, address)
def sock_accept(self, sock):
return self._proactor.accept(sock)