From fc87d6e0887ac9c52db20c20bc7d7cf34f237425 Mon Sep 17 00:00:00 2001 From: WAAutoMaton Date: Mon, 4 Dec 2017 15:43:44 +0800 Subject: [PATCH] fix 'IO.close' --- cyaron/io.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cyaron/io.py b/cyaron/io.py index 83497fc..c0a12fb 100644 --- a/cyaron/io.py +++ b/cyaron/io.py @@ -106,8 +106,10 @@ def close(self): deleted = True except OSError: pass - self.input_file.close() - self.output_file.close() + if isinstance(self.input_file, IOBase): + self.input_file.close() + if isinstance(self.output_file, IOBase): + self.output_file.close() if not deleted: self.__del_files() self.__closed = True