commit | 469734b996915d2257639a671715539ad42e2576 | [log] [tgz] |
---|---|---|
author | Guido van Rossum <guido@python.org> | Tue Jul 10 12:00:45 2007 +0000 |
committer | Guido van Rossum <guido@python.org> | Tue Jul 10 12:00:45 2007 +0000 |
tree | a96f42f66959e129766ca4c61e36a5912b98ea97 | |
parent | 47f17d01751f0b8186d6e08f4019f5b1bacf9512 [diff] |
Set closed flag *after* calling flush().
diff --git a/Lib/io.py b/Lib/io.py index 72c9e17..ed94665 100644 --- a/Lib/io.py +++ b/Lib/io.py
@@ -227,8 +227,10 @@ '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()."""