diff --git a/Lib/_pyio.py b/Lib/_pyio.py index b2d17e9809a..3fd1afedde7 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -1438,7 +1438,7 @@ class TextIOWrapper(TextIOBase): def close(self): try: self.flush() - except: + except IOError: pass # If flush() fails, just give up self.buffer.close()