[Python-bugs-list] [Bug #133041] ftplib close() shouldn't delete self.sock, self.file

noreply@sourceforge.net noreply@sourceforge.net
Sun, 18 Feb 2001 20:02:36 -0800


Bug #133041, was updated on 2001-Feb-18 20:02
Here is a current snapshot of the bug.

Project: Python
Category: Python Library
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Submitted by: nobody
Assigned to : nobody
Summary: ftplib close() shouldn't delete self.sock, self.file

Details: In FTP.__init__ it does:
		self.sock = None
		self.file = None

But in FTP.__close__ it does:
	def close(self):
		'''Close the connection without assuming anything about it.'''
		self.file.close()
		self.sock.close()
		del self.file, self.sock

This seems wrong -- instead of "del self.file, self.sock", shouldn't it be
"self.file = self.sock = None"?

This is a bug if only for the reason that it can lead to errors being
thrown that are not in ftplib.all_errors (i.e. an AttributeError).


For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=133041&group_id=5470