Skip to content

Commit 9c9eea6

Browse files
committed
pythongh-126499: test_ssl: Don't assume err.reason is a string
The skipping machinery called `getattr(err, "reason", "")` on an arbitrary exception. As intermittent Buildbot failures show, sometimes it's set to None. Convert it to string for this specific check.
1 parent a1c57bc commit 9c9eea6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/test/test_ssl.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5029,7 +5029,7 @@ def non_linux_skip_if_other_okay_error(self, err):
50295029
return # Expect the full test setup to always work on Linux.
50305030
if (isinstance(err, ConnectionResetError) or
50315031
(isinstance(err, OSError) and err.errno == errno.EINVAL) or
5032-
re.search('wrong.version.number', getattr(err, "reason", ""), re.I)):
5032+
re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I)):
50335033
# On Windows the TCP RST leads to a ConnectionResetError
50345034
# (ECONNRESET) which Linux doesn't appear to surface to userspace.
50355035
# If wrap_socket() winds up on the "if connected:" path and doing

0 commit comments

Comments
 (0)