[Python-bugs-list] [ python-Bugs-233041 ] ftplib close() shouldn't delete self.sock, self.file
nobody
nobody@sourceforge.net
Wed, 28 Feb 2001 13:49:24 -0800
Bugs #233041, was updated on 2001-02-18 20:02
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=233041&group_id=5470
Category: Python Library
Group: Not a Bug
Status: Closed
Priority: 5
Submitted By: Nobody/Anonymous
Assigned to: Fred L. Drake, Jr.
Summary: ftplib close() shouldn't delete self.sock, self.file
Initial Comment:
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).
----------------------------------------------------------------------
Comment By: Fred L. Drake, Jr.
Date: 2001-02-28 13:49
Message:
Logged In: YES
user_id=3066
ftplib.all_errors is a list of FTP-related errors, not all errors that the code could conceivably raise. This is not a bug.
On the other hand, a change similar to the one you describe was added in Lib/ftplib.py revision 1.52, but for a different reason (to allow close to be called more than once).
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=233041&group_id=5470