Re: [Python-Dev] [Python-checkins] r88505 - python/branches/py3k/Lib/ftplib.py
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
I'll do.
2011/2/23 Victor Stinner
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
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/g.rodola%40gmail.com
participants (2)
-
Giampaolo Rodolà
-
Victor Stinner