Mercurial > hg
diff mercurial/util.py @ 39905:4017968f0a1d
util: use a context manager in readlock()
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 28 Sep 2018 22:18:45 -0400 |
parents | 5fe0b880200e |
children | e2697acd9381 |
line wrap: on
line diff
--- 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.'''