From: Mikhail Galanin Date: Thu, 27 Sep 2018 09:24:03 +0000 (+0100) Subject: [Minor] Close file once it is not needed X-Git-Tag: 1.8.1~144^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F2539%2Fhead;p=thirdparty%2Frspamd.git [Minor] Close file once it is not needed --- diff --git a/test/functional/lib/rspamd.py b/test/functional/lib/rspamd.py index eeb5f27997..313e8393e3 100644 --- a/test/functional/lib/rspamd.py +++ b/test/functional/lib/rspamd.py @@ -116,10 +116,10 @@ def path_splitter(path): def read_log_from_position(filename, offset): offset = long(offset) - f = open(filename, 'rb') - f.seek(offset) - goo = f.read() - size = len(goo) + with open(filename, 'rb') as f: + f.seek(offset) + goo = f.read() + size = len(goo) return [goo, size+offset] def rspamc(addr, port, filename):