Issue #23197, asyncio: On SSL handshake failure, check if the waiter is

cancelled before setting its exception.

* Add unit tests for this case.
* Cleanup also sslproto.py
This commit is contained in:
Victor Stinner 2015-01-14 16:56:20 +01:00
parent f651a60407
commit 177e9f0855
4 changed files with 65 additions and 7 deletions

View file

@ -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