Skip to content

Commit eb2afa6

Browse files
committed
ssl: Sync with CPython
1 parent 76b34be commit eb2afa6

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

uvloop/sslproto.pyx

+6-12
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ class SSLProtocol(object):
496496
ssldata, appdata = (<_SSLPipe>self._sslpipe).feed_ssldata(data)
497497
except ssl_SSLError as e:
498498
msg = (
499-
f'{self}: SSL error errno:{getattr(e, "errno", "missing")} '
499+
f'SSL error errno:{getattr(e, "errno", "missing")} '
500500
f'reason: {getattr(e, "reason", "missing")}'
501501
)
502502
self._fatal_error(e, msg)
@@ -576,7 +576,7 @@ class SSLProtocol(object):
576576
def _check_handshake_timeout(self):
577577
if self._in_handshake is True:
578578
msg = (
579-
f"SSL handshake for {self} is taking longer than "
579+
f"SSL handshake is taking longer than "
580580
f"{self._ssl_handshake_timeout} seconds: "
581581
f"aborting the connection"
582582
)
@@ -594,12 +594,9 @@ class SSLProtocol(object):
594594
peercert = sslobj.getpeercert()
595595
except Exception as exc:
596596
if isinstance(exc, ssl_CertificateError):
597-
msg = (
598-
f'{self}: SSL handshake failed on verifying '
599-
f'the certificate'
600-
)
597+
msg = 'SSL handshake failed on verifying the certificate'
601598
else:
602-
msg = f'{self}: SSL handshake failed'
599+
msg = 'SSL handshake failed'
603600
self._fatal_error(exc, msg)
604601
return
605602

@@ -661,15 +658,12 @@ class SSLProtocol(object):
661658
# delete it and reduce the outstanding buffer size.
662659
del self._write_backlog[0]
663660
self._write_buffer_size -= len(data)
664-
except BaseException as exc:
661+
except Exception as exc:
665662
if self._in_handshake:
666-
# BaseExceptions will be re-raised in _on_handshake_complete.
663+
# Exceptions will be re-raised in _on_handshake_complete.
667664
self._on_handshake_complete(exc)
668665
else:
669666
self._fatal_error(exc, 'Fatal error on SSL transport')
670-
if not isinstance(exc, Exception):
671-
# BaseException
672-
raise
673667

674668
def _fatal_error(self, exc, message='Fatal error on transport'):
675669
if self._transport:

0 commit comments

Comments
 (0)