[Python-checkins] r79384 - python/trunk/Lib/test/test_ftplib.py

antoine.pitrou python-checkins at python.org
Wed Mar 24 22:55:12 CET 2010


Author: antoine.pitrou
Date: Wed Mar 24 22:55:12 2010
New Revision: 79384

Log:
Trying to fix #8108.  Will watch the buildbot(s).



Modified:
   python/trunk/Lib/test/test_ftplib.py

Modified: python/trunk/Lib/test/test_ftplib.py
==============================================================================
--- python/trunk/Lib/test/test_ftplib.py	(original)
+++ python/trunk/Lib/test/test_ftplib.py	Wed Mar 24 22:55:12 2010
@@ -315,12 +315,21 @@
             raise
 
         def close(self):
+            ssl_want_read_or_write = False
             try:
                 if isinstance(self.socket, ssl.SSLSocket):
                     if self.socket._sslobj is not None:
-                        self.socket.unwrap()
+                        try:
+                            self.socket.unwrap()
+                        except ssl.SSLError, err:
+                            if err.args[0] in (ssl.SSL_ERROR_WANT_READ,
+                                               ssl.SSL_ERROR_WANT_WRITE):
+                                ssl_want_read_or_write = True
+                            else:
+                                raise
             finally:
-                super(SSLConnection, self).close()
+                if not ssl_want_read_or_write:
+                    super(SSLConnection, self).close()
 
 
     class DummyTLS_DTPHandler(SSLConnection, DummyDTPHandler):


More information about the Python-checkins mailing list