[Python-checkins] [3.6] bpo-31320: No traceback to sys.stderr in test_ssl (GH-3360) (GH-3369)
Mariatta
webhook-mailer at python.org
Tue Sep 5 21:11:34 EDT 2017
https://github.com/python/cpython/commit/c506403faf8dbfc8baf4212e8e2aedb7268acb5e
commit: c506403faf8dbfc8baf4212e8e2aedb7268acb5e
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Mariatta <Mariatta at users.noreply.github.com>
date: 2017-09-05T18:11:31-07:00
summary:
[3.6] bpo-31320: No traceback to sys.stderr in test_ssl (GH-3360) (GH-3369)
In case PROTOCOL_TLS_SERVER is used for both client context and server
context, the test thread dies with OSError. Catch OSError to avoid
traceback on sys.stderr
Signed-off-by: Christian Heimes <christian at python.org>
(cherry picked from commit 305e56c27afce605e5d2f71903a966cf0bb95038)
files:
A Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst
M Lib/test/test_ssl.py
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 4c060ea1c1e..29d4b4083da 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -1843,11 +1843,14 @@ def wrap_conn(self):
self.sock, server_side=True)
self.server.selected_npn_protocols.append(self.sslconn.selected_npn_protocol())
self.server.selected_alpn_protocols.append(self.sslconn.selected_alpn_protocol())
- except (ssl.SSLError, ConnectionResetError) as e:
+ except (ssl.SSLError, ConnectionResetError, OSError) as e:
# We treat ConnectionResetError as though it were an
# SSLError - OpenSSL on Ubuntu abruptly closes the
# connection when asked to use an unsupported protocol.
#
+ # OSError may occur with wrong protocols, e.g. both
+ # sides use PROTOCOL_TLS_SERVER.
+ #
# XXX Various errors can have happened here, for example
# a mismatching protocol version, an invalid certificate,
# or a low-level bug. This should be made more discriminating.
diff --git a/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst b/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst
new file mode 100644
index 00000000000..8b7163dfe79
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst
@@ -0,0 +1 @@
+Silence traceback in test_ssl
More information about the Python-checkins
mailing list