diff options
Diffstat (limited to 'logilab/common/fileutils.py')
-rw-r--r-- | logilab/common/fileutils.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/logilab/common/fileutils.py b/logilab/common/fileutils.py index 48828fb..93439d3 100644 --- a/logilab/common/fileutils.py +++ b/logilab/common/fileutils.py @@ -283,10 +283,8 @@ def lines(path, comments=None): :warning: at some point this function will probably return an iterator """ - stream = io.open(path) - result = stream_lines(stream, comments) - stream.close() - return result + with io.open(path) as stream: + return stream_lines(stream, comments) def stream_lines(stream, comments=None): |