diff -r 5fe0b880200e -r 4017968f0a1d mercurial/util.py --- a/mercurial/util.py Tue Sep 25 21:16:12 2018 -0400 +++ b/mercurial/util.py Fri Sep 28 22:18:45 2018 -0400 @@ -1848,10 +1848,8 @@ raise except AttributeError: # no symlink in os pass - fp = posixfile(pathname, 'rb') - r = fp.read() - fp.close() - return r + with posixfile(pathname, 'rb') as fp: + return fp.read() def fstat(fp): '''stat file object that may not have fileno method.'''