[Python-bugs-list] [Bug #113850] posixfile __del__ method is wrong

noreply@sourceforge.net noreply@sourceforge.net
Thu, 7 Sep 2000 21:43:25 -0700


Bug #113850, was updated on 2000-Sep-07 21:43
Here is a current snapshot of the bug.

Project: Python
Category: None
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Summary: posixfile __del__ method is wrong

Details: The posixfile __del__ method attempts to close the
file (_file_) it contains.  However, if the open
method fails, then _file_ is never assigned.
The solution is to modify __del__ as follows:

def __del__(self):
  if hasattr(self, '_file_'):
    self._file_.close()

-Kevin Jacobs (jacobs@darwin.cwru.edu)


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