diff --git a/Lib/tempfile.py b/Lib/tempfile.py index 74e3cb2b568..8cdefaa635b 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -408,6 +408,9 @@ def __exit__(self, exc, value, tb): result = self.file.__exit__(exc, value, tb) self.close() return result + else: + def __exit__(self, exc, value, tb): + pass def NamedTemporaryFile(mode='w+b', buffering=-1, encoding=None,