summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-04-26 17:28:35 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-04-26 17:28:35 (GMT)
commit34fbacdc1151480ce5a216785963e3451ab94aca (patch)
tree6342c678c14521d5926fe1e309d5b506158c83e2
parentefa7454dfcc33ee15deae94a5946100751ee3477 (diff)
downloadcpython-34fbacdc1151480ce5a216785963e3451ab94aca.zip
cpython-34fbacdc1151480ce5a216785963e3451ab94aca.tar.gz
cpython-34fbacdc1151480ce5a216785963e3451ab94aca.tar.bz2
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. ........
-rw-r--r--Lib/ssl.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/ssl.py b/Lib/ssl.py
index 8f88d15..1af9fa9 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -75,8 +75,10 @@ from _ssl import \
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 @@ class SSLSocket(socket):
# 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: