In FTP.close() method, make sure to also close the socket object, not only the file.
This commit is contained in:
parent
4cfa24757b
commit
d686848807
|
@ -589,12 +589,12 @@ 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
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
Loading…
Reference in New Issue