diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-04-26 17:23:33 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-04-26 17:23:33 (GMT) |
commit | 278d665c6a407ca1c1b26009b5a51f341f64a027 (patch) | |
tree | 2bcd5732dae5166049203207144bcc1cb095bcc8 | |
parent | 3bfa8832076201bebd6348f1df0cb84645d0d462 (diff) | |
download | cpython-278d665c6a407ca1c1b26009b5a51f341f64a027.zip cpython-278d665c6a407ca1c1b26009b5a51f341f64a027.tar.gz cpython-278d665c6a407ca1c1b26009b5a51f341f64a027.tar.bz2 |
When calling getpeername() in SSLSocket.__init__, only silence exceptions
caused by the "socket not connected" condition.
-rw-r--r-- | Lib/ssl.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -78,6 +78,7 @@ from _ssl import \ from socket import socket, _fileobject, _delegate_methods, error as socket_error from socket import getnameinfo as _getnameinfo import base64 # for DER-to-PEM translation +import errno class SSLSocket(socket): @@ -105,7 +106,9 @@ class SSLSocket(socket): # see if it's connected try: socket.getpeername(self) - except socket_error: + except socket_error, e: + if e.errno != errno.ENOTCONN: + raise # no, no connection yet self._sslobj = None else: |