##// END OF EJS Templates
util: use a context manager in readlock()
Matt Harbison -
r39941:4017968f default
parent child Browse files
Show More
@@ -1848,10 +1848,8 b' def readlock(pathname):'
1848 raise
1848 raise
1849 except AttributeError: # no symlink in os
1849 except AttributeError: # no symlink in os
1850 pass
1850 pass
1851 fp = posixfile(pathname, 'rb')
1851 with posixfile(pathname, 'rb') as fp:
1852 r = fp.read()
1852 return fp.read()
1853 fp.close()
1854 return r
1855
1853
1856 def fstat(fp):
1854 def fstat(fp):
1857 '''stat file object that may not have fileno method.'''
1855 '''stat file object that may not have fileno method.'''
General Comments 0
You need to be logged in to leave comments. Login now