Commit 7fa0438c authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #23865: close() methods in multiple modules now are idempotent and more

robust at shutdown. If needs to release multiple resources, they are released
even if errors are occured.
parent 1f83754d
......@@ -118,10 +118,11 @@ class TextFile:
def close(self):
"""Close the current file and forget everything we know about it
(filename, current line number)."""
self.file.close()
file = self.file
self.file = None
self.filename = None
self.current_line = None
file.close()
def gen_error(self, msg, line=None):
outmsg = []
......
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