mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Set closed flag *after* calling flush().
This commit is contained in:
parent
47f17d0175
commit
469734b996
1 changed files with 4 additions and 2 deletions
|
@ -227,8 +227,10 @@ class IOBase:
|
||||||
'closed' property (see below) to test.
|
'closed' property (see below) to test.
|
||||||
"""
|
"""
|
||||||
if not self.__closed:
|
if not self.__closed:
|
||||||
self.__closed = True
|
try:
|
||||||
self.flush()
|
self.flush()
|
||||||
|
finally:
|
||||||
|
self.__closed = True
|
||||||
|
|
||||||
def __del__(self) -> None:
|
def __del__(self) -> None:
|
||||||
"""Destructor. Calls close()."""
|
"""Destructor. Calls close()."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue