summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-01-14 22:44:41 +0100
committerVictor Stinner <victor.stinner@gmail.com>2015-01-14 22:44:41 +0100
commit03aa11c221465f30dc9386f9e172ef3b2c9b0586 (patch)
treeffa5d154ec4e5cb062fe41bfdfe77bb7b684afe7
parent9c3c28069fb91d0bf63d02cf3ac62a9aa9046af7 (diff)
downloadtrollius-03aa11c221465f30dc9386f9e172ef3b2c9b0586.tar.gz
Fix BaseEventLoop._create_connection_transport()
Close the transport if the creation of the transport (if the waiter) gets an exception.
-rw-r--r--asyncio/base_events.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/asyncio/base_events.py b/asyncio/base_events.py
index 35c8d74..5df5b83 100644
--- a/asyncio/base_events.py
+++ b/asyncio/base_events.py
@@ -634,7 +634,12 @@ class BaseEventLoop(events.AbstractEventLoop):
else:
transport = self._make_socket_transport(sock, protocol, waiter)
- yield from waiter
+ try:
+ yield from waiter
+ except Exception as exc:
+ transport.close()
+ raise
+
return transport, protocol
@coroutine