[Python-checkins] r80508 - in python/branches/release26-maint: Lib/ssl.py

antoine.pitrou python-checkins at python.org
Mon Apr 26 19:28:35 CEST 2010


Author: antoine.pitrou
Date: Mon Apr 26 19:28:35 2010
New Revision: 80508

Log:
Merged revisions 80507 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80507 | antoine.pitrou | 2010-04-26 19:23:33 +0200 (lun., 26 avril 2010) | 4 lines
  
  When calling getpeername() in SSLSocket.__init__, only silence exceptions
  caused by the "socket not connected" condition.
........


Modified:
   python/branches/release26-maint/   (props changed)
   python/branches/release26-maint/Lib/ssl.py

Modified: python/branches/release26-maint/Lib/ssl.py
==============================================================================
--- python/branches/release26-maint/Lib/ssl.py	(original)
+++ python/branches/release26-maint/Lib/ssl.py	Mon Apr 26 19:28:35 2010
@@ -75,8 +75,10 @@
      SSL_ERROR_INVALID_ERROR_CODE
 
 from socket import socket, _fileobject, _delegate_methods
+from socket import error as socket_error
 from socket import getnameinfo as _getnameinfo
 import base64        # for DER-to-PEM translation
+import errno
 
 class SSLSocket(socket):
 
@@ -104,7 +106,9 @@
         # see if it's connected
         try:
             socket.getpeername(self)
-        except:
+        except socket_error, e:
+            if e.errno != errno.ENOTCONN:
+                raise
             # no, no connection yet
             self._sslobj = None
         else:


More information about the Python-checkins mailing list