mirror of
https://github.com/python/cpython
synced 2024-09-24 03:19:16 +00:00
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.
This commit is contained in:
parent
8f422461b4
commit
16c4aa441b
|
@ -68,7 +68,8 @@ def __repr__(self):
|
|||
hex(id(self))[2:])
|
||||
|
||||
def __del__(self):
|
||||
self._file_.close()
|
||||
if hasattr(self, "_file_"):
|
||||
self._file_.close()
|
||||
|
||||
#
|
||||
# Initialization routines
|
||||
|
|
Loading…
Reference in a new issue