diff options
Diffstat (limited to 'Lib/fileinput.py')
-rw-r--r-- | Lib/fileinput.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/fileinput.py b/Lib/fileinput.py index 90a600b..a25a021 100644 --- a/Lib/fileinput.py +++ b/Lib/fileinput.py @@ -238,6 +238,12 @@ class FileInput: self.nextfile() self._files = () + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + self.close() + def __iter__(self): return self |