mirror of
https://github.com/python/cpython.git
synced 2025-11-27 05:44: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
1 changed files with 2 additions and 1 deletions
|
|
@ -68,6 +68,7 @@ class _posixfile_:
|
||||||
hex(id(self))[2:])
|
hex(id(self))[2:])
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
|
if hasattr(self, "_file_"):
|
||||||
self._file_.close()
|
self._file_.close()
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue