Close all open filehandle (#50544)

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2019-01-11 20:44:08 +05:30 committed by Brian Coca
commit db8702cdb8
21 changed files with 81 additions and 47 deletions

View file

@ -170,7 +170,9 @@ ZIP_FILE_MODE_RE = re.compile(r'([r-][w-][SsTtx-]){3}')
def crc32(path):
''' Return a CRC32 checksum of a file '''
return binascii.crc32(open(path, 'rb').read()) & 0xffffffff
with open(path, 'rb') as f:
file_content = f.read()
return binascii.crc32(file_content) & 0xffffffff
def shell_escape(string):