[Python-checkins] r88505 - python/branches/py3k/Lib/ftplib.py

giampaolo.rodola python-checkins at python.org
Tue Feb 22 20:24:33 CET 2011


Author: giampaolo.rodola
Date: Tue Feb 22 20:24:33 2011
New Revision: 88505

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

Modified:
   python/branches/py3k/Lib/ftplib.py

Modified: python/branches/py3k/Lib/ftplib.py
==============================================================================
--- python/branches/py3k/Lib/ftplib.py	(original)
+++ python/branches/py3k/Lib/ftplib.py	Tue Feb 22 20:24:33 2011
@@ -589,11 +589,11 @@
 
     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


More information about the Python-checkins mailing list