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

Victor Stinner victor.stinner at haypocalc.com
Wed Feb 23 02:25:34 CET 2011


You should maybe backport this fix to Python 3.2.

Le mardi 22 février 2011 à 20:24 +0100, giampaolo.rodola a écrit :
> 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
>  



More information about the Python-Dev mailing list