Commit 55b9e8eb authored by Giampaolo Rodolà's avatar Giampaolo Rodolà

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

parent 139f51a2
...@@ -589,11 +589,11 @@ class FTP: ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment