Issue #16647: save socket error details in LMTP.connect()

Patch by Serhiy Storchaka.
This commit is contained in:
Andrew Svetlov 2012-12-17 18:54:53 +02:00
parent fc3278802c
commit b6693c4604
1 changed files with 2 additions and 2 deletions

View File

@ -892,13 +892,13 @@ class LMTP(SMTP):
try:
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.sock.connect(host)
except socket.error as msg:
except socket.error:
if self.debuglevel > 0:
print('connect fail:', host, file=stderr)
if self.sock:
self.sock.close()
self.sock = None
raise socket.error(msg)
raise
(code, msg) = self.getreply()
if self.debuglevel > 0:
print('connect:', msg, file=stderr)