diff options
author | Fred Drake <fdrake@acm.org> | 2000-09-09 06:26:40 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-09-09 06:26:40 (GMT) |
commit | 16c4aa441bba65ac0e4386e4b04d25119e8fc609 (patch) | |
tree | 2e2fbbe1bd7eca260dbcaeb8cc24a78a5285bc58 /Lib/posixfile.py | |
parent | 8f422461b4c19b8a66beae218311917e688f03ce (diff) | |
download | cpython-16c4aa441bba65ac0e4386e4b04d25119e8fc609.zip cpython-16c4aa441bba65ac0e4386e4b04d25119e8fc609.tar.gz cpython-16c4aa441bba65ac0e4386e4b04d25119e8fc609.tar.bz2 |
Kevin Jacobs <jacobs@darwin.cwru.edu>:
The posixfile __del__ method attempts to close the file (_file_) it
contains. However, if the open() method fails, then _file_ is never
assigned.
This closes SourceForge bug #113850.
Diffstat (limited to 'Lib/posixfile.py')
-rw-r--r-- | Lib/posixfile.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/posixfile.py b/Lib/posixfile.py index d358dc4..18f72fd 100644 --- a/Lib/posixfile.py +++ b/Lib/posixfile.py @@ -68,7 +68,8 @@ class _posixfile_: hex(id(self))[2:]) def __del__(self): - self._file_.close() + if hasattr(self, "_file_"): + self._file_.close() # # Initialization routines |