Merge pull request #13090 from mesosphere/finally-undefined

Fix undefined variable f in 'finally' clause of verify-flags-underscore
pull/6/head
Nikhil Jindal 2015-08-24 14:06:59 -07:00
commit 4e51cb2a86
1 changed files with 9 additions and 10 deletions

View File

@ -36,7 +36,7 @@ def is_binary(pathname):
@author: Trent Mick <TrentM@ActiveState.com>
@author: Jorge Orpinel <jorge@orpinel.com>"""
try:
f = open(pathname, 'r')
with open(pathname, 'r') as f:
CHUNKSIZE = 1024
while 1:
chunk = f.read(CHUNKSIZE)
@ -46,8 +46,7 @@ def is_binary(pathname):
break # done
except:
return True
finally:
f.close()
return False
def get_all_files(rootdir):