summaryrefslogtreecommitdiff
path: root/asyncio
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-01-14 16:51:38 +0100
committerVictor Stinner <victor.stinner@gmail.com>2015-01-14 16:51:38 +0100
commit715607db3f5c67e8d3ca7a5e0e03e2316e232c9b (patch)
tree030a113c980d7d376d233d699a23cfe5380b4bc2 /asyncio
parente1eb834ee239ec54998a0b5174e1f0ea33bc4ece (diff)
downloadtrollius-715607db3f5c67e8d3ca7a5e0e03e2316e232c9b.tar.gz
Python issue #23197: On SSL handshake failure, check if the waiter is cancelled
before setting its exception. Add unit tests for this case.
Diffstat (limited to 'asyncio')
-rw-r--r--asyncio/selector_events.py2
-rw-r--r--asyncio/sslproto.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/asyncio/selector_events.py b/asyncio/selector_events.py
index b2f29c7..ca86264 100644
--- a/asyncio/selector_events.py
+++ b/asyncio/selector_events.py
@@ -750,7 +750,7 @@ class _SelectorSslTransport(_SelectorTransport):
self._loop.remove_reader(self._sock_fd)
self._loop.remove_writer(self._sock_fd)
self._sock.close()
- if self._waiter is not None:
+ if self._waiter is not None and not self._waiter.cancelled():
self._waiter.set_exception(exc)
if isinstance(exc, Exception):
return
diff --git a/asyncio/sslproto.py b/asyncio/sslproto.py
index dc03cf5..541e252 100644
--- a/asyncio/sslproto.py
+++ b/asyncio/sslproto.py
@@ -552,7 +552,7 @@ class SSLProtocol(protocols.Protocol):
self, exc_info=True)
self._transport.close()
if isinstance(exc, Exception):
- if self._waiter is not None:
+ if self._waiter is not None and not self._waiter.cancelled():
self._waiter.set_exception(exc)
return
else: