Fix new bug in ftplib.py introduced by exception scope limitation.

This commit is contained in:
Guido van Rossum 2007-01-14 18:43:49 +00:00
parent 3a4e97861f
commit 56be3b1cdc

View File

@ -119,7 +119,8 @@ class FTP:
try: try:
self.sock = socket.socket(af, socktype, proto) self.sock = socket.socket(af, socktype, proto)
self.sock.connect(sa) self.sock.connect(sa)
except socket.error as msg: except socket.error as err:
msg = err
if self.sock: if self.sock:
self.sock.close() self.sock.close()
self.sock = None self.sock = None