]> granicus.if.org Git - python/commitdiff
In FTP.close() method, make sure to also close the socket object, not only the file.
authorGiampaolo Rodolà <g.rodola@gmail.com>
Tue, 22 Feb 2011 19:24:33 +0000 (19:24 +0000)
committerGiampaolo Rodolà <g.rodola@gmail.com>
Tue, 22 Feb 2011 19:24:33 +0000 (19:24 +0000)
Lib/ftplib.py

index 22b5fd2175a44c90d86b9fdc6d70a02a87a7fb24..fd5a8633e36d16991743f47199f4e3421647d7f3 100644 (file)
@@ -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