Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Lib/ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,12 @@ def _create(cls, sock, server_side=False, do_handshake_on_connect=True,
notconn_pre_handshake_data = self.recv(1)
except OSError as e:
# EINVAL occurs for recv(1) on non-connected on unix sockets.
if e.errno not in (errno.ENOTCONN, errno.EINVAL):
if e.errno in (errno.ENOTCONN, errno.EINVAL):
pass
elif sys.platform == 'cygwin' and e.errno == errno.EAGAIN:
# EAGAIN occurs on Cygwin.
pass
else:
raise
notconn_pre_handshake_data = b''
self.setblocking(blocking)
Expand Down
7 changes: 5 additions & 2 deletions Lib/test/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ def test_refcycle(self):
del ss
self.assertEqual(wr(), None)

@unittest.skipIf(sys.platform == 'cygwin', 'test hangs on Cygwin')
def test_wrapped_unconnected(self):
# Methods on an unconnected SSLSocket propagate the original
# OSError raise by the underlying socket object.
Expand Down Expand Up @@ -3631,7 +3632,7 @@ def test_wrong_cert_tls13(self):
OSError,
'alert unknown ca|EOF occurred|TLSV1_ALERT_UNKNOWN_CA|'
'closed by the remote host|Connection reset by peer|'
'Broken pipe'
'Broken pipe|Software caused connection abort'
):
# TLS 1.3 perform client cert exchange after handshake
s.write(b'data')
Expand Down Expand Up @@ -4585,6 +4586,8 @@ def test_client_sigalgs_mismatch(self):
ssl.SSLError,
# On handshake failures, some systems raise a ConnectionResetError.
ConnectionResetError,
# On handshake failures, Cygwin raises ConnectionAbortedError.
ConnectionAbortedError,
# On handshake failures, macOS may raise a BrokenPipeError.
# See https://github.com/python/cpython/issues/139504.
BrokenPipeError,
Expand Down Expand Up @@ -5693,7 +5696,7 @@ def run(self):
def non_linux_skip_if_other_okay_error(self, err):
if sys.platform in ("linux", "android"):
return # Expect the full test setup to always work on Linux.
if (isinstance(err, ConnectionResetError) or
if (isinstance(err, (ConnectionResetError, ConnectionAbortedError)) or
(isinstance(err, OSError) and err.errno == errno.EINVAL) or
re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I) or
re.search('record.layer.failure', str(getattr(err, "reason", "")), re.I)
Expand Down
Loading