summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/base_events.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-06-05 14:18:20 (GMT)
committerYury Selivanov <yury@magic.io>2018-06-05 14:18:20 (GMT)
commit79c7e57c46a9e5ae2b99a821e152f334b775df2d (patch)
treeae2c54431490393d1bbaf911f8af90c357d0bcf8 /Lib/asyncio/base_events.py
parentffd72acc508bbc994812cefbfb9532d3be2ab737 (diff)
downloadcpython-79c7e57c46a9e5ae2b99a821e152f334b775df2d.zip
cpython-79c7e57c46a9e5ae2b99a821e152f334b775df2d.tar.gz
cpython-79c7e57c46a9e5ae2b99a821e152f334b775df2d.tar.bz2
bpo-33769: start_tls: Fix error message; cancel callbacks on error (GH-7403) (GH-7428)
In addition to that, mark SSLTransport as "closed" in its "abort()" method to prevent bogus warnings. (cherry picked from commit 415bc46a78e785f357c8960ae70f18a6b6cccbb6) Co-authored-by: Yury Selivanov <yury@magic.io>
Diffstat (limited to 'Lib/asyncio/base_events.py')
-rw-r--r--Lib/asyncio/base_events.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index 34cc625..68a1ebe 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -1097,7 +1097,7 @@ class BaseEventLoop(events.AbstractEventLoop):
if not getattr(transport, '_start_tls_compatible', False):
raise TypeError(
- f'transport {self!r} is not supported by start_tls()')
+ f'transport {transport!r} is not supported by start_tls()')
waiter = self.create_future()
ssl_protocol = sslproto.SSLProtocol(
@@ -1111,13 +1111,15 @@ class BaseEventLoop(events.AbstractEventLoop):
transport.pause_reading()
transport.set_protocol(ssl_protocol)
- self.call_soon(ssl_protocol.connection_made, transport)
- self.call_soon(transport.resume_reading)
+ conmade_cb = self.call_soon(ssl_protocol.connection_made, transport)
+ resume_cb = self.call_soon(transport.resume_reading)
try:
await waiter
except Exception:
transport.close()
+ conmade_cb.cancel()
+ resume_cb.cancel()
raise
return ssl_protocol._app_transport