Mercurial > hg-stable
changeset 39910: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 | 2327abace563 |
files | mercurial/util.py |
diffstat | 1 files changed, 2 insertions(+), 4 deletions(-) [+] |
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.'''