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
commitf2e08a0325a28cdd3af1223312c9982525cd12bb (patch)
treeffa5d154ec4e5cb062fe41bfdfe77bb7b684afe7
parentd5cc0307ee96db861b40d4ec6f4a217f1a40fcd3 (diff)
downloadtrollius-git-f2e08a0325a28cdd3af1223312c9982525cd12bb.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