From: Giampaolo RodolĂ  Date: Tue, 22 Feb 2011 19:24:33 +0000 (+0000) Subject: In FTP.close() method, make sure to also close the socket object, not only the file. X-Git-Tag: v3.3.0a1~3120 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d686848807dc35ee84524c64aa7a17d9a5b927ad;p=python In FTP.close() method, make sure to also close the socket object, not only the file. --- diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 22b5fd2175..fd5a8633e3 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -589,11 +589,11 @@ class FTP: def close(self): '''Close the connection without assuming anything about it.''' - if self.file: + if self.file is not None: self.file.close() + if self.sock is not None: self.sock.close() - self.file = self.sock = None - + self.file = self.sock = None try: import ssl