[Python-checkins] cpython (3.2): Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu.

nadeem.vawda python-checkins at python.org
Sun Mar 3 22:34:50 CET 2013


http://hg.python.org/cpython/rev/fa24c1382bd3
changeset:   82462:fa24c1382bd3
branch:      3.2
parent:      82447:23669bea387e
user:        Nadeem Vawda <nadeem.vawda at gmail.com>
date:        Sun Mar 03 22:31:21 2013 +0100
summary:
  Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu.

files:
  Lib/test/test_ssl.py |  8 +++++++-
  Misc/NEWS            |  2 ++
  2 files changed, 9 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -774,7 +774,13 @@
                 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.
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -947,6 +947,8 @@
 Tests
 -----
 
+- Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu.
+
 - Issue #17249: convert a test in test_capi to use unittest and reap threads.
 
 - Issue #17041: Fix testing when Python is configured with the

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list