summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-04-26 17:23:33 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-04-26 17:23:33 (GMT)
commit278d665c6a407ca1c1b26009b5a51f341f64a027 (patch)
tree2bcd5732dae5166049203207144bcc1cb095bcc8
parent3bfa8832076201bebd6348f1df0cb84645d0d462 (diff)
downloadcpython-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.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/ssl.py b/Lib/ssl.py
index 1d29bef..bfeb559 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -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: