diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 9b59ddd887a..17752342662 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -4817,7 +4817,7 @@ class TestPreHandshakeClose(unittest.TestCase): return # Expect the full test setup to always work on Linux. if (isinstance(err, ConnectionResetError) or (isinstance(err, OSError) and err.errno == errno.EINVAL) or - re.search('wrong.version.number', getattr(err, "reason", ""), re.I)): + re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I)): # On Windows the TCP RST leads to a ConnectionResetError # (ECONNRESET) which Linux doesn't appear to surface to userspace. # If wrap_socket() winds up on the "if connected:" path and doing