[Python-checkins] cpython (3.4): asyncio: Make sure BaseException is re-raised in SSLProtocol

yury.selivanov python-checkins at python.org
Wed Aug 5 20:07:46 CEST 2015


https://hg.python.org/cpython/rev/ee8e9edb8aae
changeset:   97280:ee8e9edb8aae
branch:      3.4
parent:      97277:7aa2d3e1c885
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Wed Aug 05 14:06:23 2015 -0400
summary:
  asyncio: Make sure BaseException is re-raised in SSLProtocol

files:
  Lib/asyncio/sslproto.py |  7 ++++++-
  1 files changed, 6 insertions(+), 1 deletions(-)


diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
--- a/Lib/asyncio/sslproto.py
+++ b/Lib/asyncio/sslproto.py
@@ -613,7 +613,8 @@
                 if data:
                     ssldata, offset = self._sslpipe.feed_appdata(data, offset)
                 elif offset:
-                    ssldata = self._sslpipe.do_handshake(self._on_handshake_complete)
+                    ssldata = self._sslpipe.do_handshake(
+                        self._on_handshake_complete)
                     offset = 1
                 else:
                     ssldata = self._sslpipe.shutdown(self._finalize)
@@ -637,9 +638,13 @@
                 self._write_buffer_size -= len(data)
         except BaseException as exc:
             if self._in_handshake:
+                # BaseExceptions will be re-raised in _on_handshake_complete.
                 self._on_handshake_complete(exc)
             else:
                 self._fatal_error(exc, 'Fatal error on SSL transport')
+            if not isinstance(exc, Exception):
+                # BaseException
+                raise
 
     def _fatal_error(self, exc, message='Fatal error on transport'):
         # Should be called from exception handler only.

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list