In FTP.close() method, make sure to also close the socket object, not only the file.

This commit is contained in:
Giampaolo Rodolà 2011-02-22 19:24:33 +00:00
parent 4cfa24757b
commit d686848807
1 changed files with 3 additions and 3 deletions

View File

@ -589,11 +589,11 @@ class FTP:
def close(self): def close(self):
'''Close the connection without assuming anything about it.''' '''Close the connection without assuming anything about it.'''
if self.file: if self.file is not None:
self.file.close() self.file.close()
if self.sock is not None:
self.sock.close() self.sock.close()
self.file = self.sock = None self.file = self.sock = None
try: try:
import ssl import ssl