diff options
author | Christian Heimes <christian@python.org> | 2017-09-05 23:37:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-05 23:37:09 (GMT) |
commit | 305e56c27afce605e5d2f71903a966cf0bb95038 (patch) | |
tree | c4452d8dbe14c79a6497803e29236c71c6ed4ef2 /Lib/test/test_ssl.py | |
parent | 60dbed18509f99af8eaa685d9736f954b8d621fb (diff) | |
download | cpython-305e56c27afce605e5d2f71903a966cf0bb95038.zip cpython-305e56c27afce605e5d2f71903a966cf0bb95038.tar.gz cpython-305e56c27afce605e5d2f71903a966cf0bb95038.tar.bz2 |
bpo-31320: No traceback to sys.stderr in test_ssl (#3360)
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@python.org>
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r-- | Lib/test/test_ssl.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 5916a2b..a8ffef0 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1853,11 +1853,14 @@ if _have_threads: 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. |