Skip to content

Commit 1e4b9c7

Browse files
[3.13] gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501) (GH-126574)
gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501) 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. (cherry picked from commit 78ad7e6) Co-authored-by: Petr Viktorin <[email protected]>
1 parent e194b21 commit 1e4b9c7

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
@@ -5004,7 +5004,7 @@ def non_linux_skip_if_other_okay_error(self, err):
50045004
return # Expect the full test setup to always work on Linux.
50055005
if (isinstance(err, ConnectionResetError) or
50065006
(isinstance(err, OSError) and err.errno == errno.EINVAL) or
5007-
re.search('wrong.version.number', getattr(err, "reason", ""), re.I)):
5007+
re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I)):
50085008
# On Windows the TCP RST leads to a ConnectionResetError
50095009
# (ECONNRESET) which Linux doesn't appear to surface to userspace.
50105010
# If wrap_socket() winds up on the "if connected:" path and doing

0 commit comments

Comments
 (0)