mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +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.
|
||||
"""
|
||||
if not self.__closed:
|
||||
self.__closed = True
|
||||
self.flush()
|
||||
try:
|
||||
self.flush()
|
||||
finally:
|
||||
self.__closed = True
|
||||
|
||||
def __del__(self) -> None:
|
||||
"""Destructor. Calls close()."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue