Commit 469734b9 authored by Guido van Rossum's avatar Guido van Rossum

Set closed flag *after* calling flush().

parent 47f17d01
......@@ -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()."""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment