diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2013-03-03 21:31:21 (GMT) |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2013-03-03 21:31:21 (GMT) |
commit | 7b39b9b51baf3bc421917083f2b0451c841728bc (patch) | |
tree | 6a37319fcbad3c10e919fd073b951bd73d2b968a /Lib/test | |
parent | fed69ba63c2af918a325a4fac811dff6433ce6a0 (diff) | |
download | cpython-7b39b9b51baf3bc421917083f2b0451c841728bc.zip cpython-7b39b9b51baf3bc421917083f2b0451c841728bc.tar.gz cpython-7b39b9b51baf3bc421917083f2b0451c841728bc.tar.bz2 |
Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_ssl.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 4f254a9..d1cb3f1 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -774,7 +774,13 @@ else: try: self.sslconn = self.server.context.wrap_socket( self.sock, server_side=True) - except ssl.SSLError as e: + except (ssl.SSLError, socket.error) as e: + # Treat ECONNRESET as though it were an SSLError - OpenSSL + # on Ubuntu abruptly closes the connection when asked to use + # an unsupported protocol. + if (not isinstance(e, ssl.SSLError) and + e.errno != errno.ECONNRESET): + raise # 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. |