https://github.com/python/cpython/commit/1e4b9c7faedf118d920150488ca2e0bc32f8ed85
commit: 1e4b9c7faedf118d920150488ca2e0bc32f8ed85
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: encukou <[email protected]>
date: 2024-11-11T13:56:01+01:00
summary:

[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 78ad7e632248dc989378cabeb797b9f3d940d9f2)

Co-authored-by: Petr Viktorin <[email protected]>

files:
M Lib/test/test_ssl.py

diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 9c415bd7d1c4e4..9d2deb6e4cb826 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -5004,7 +5004,7 @@ def non_linux_skip_if_other_okay_error(self, err):
             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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to