mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-14 00:21:08 +00:00
Cannot use with statement with StringIO
This commit is contained in:
parent
394d956a37
commit
e48a2c92d4
@ -76,12 +76,13 @@ class Dsc(debian.deb822.Dsc):
|
||||
if os.path.getsize(pathname) != size:
|
||||
return False
|
||||
hash_func = getattr(hashlib, alg)()
|
||||
with open(pathname, 'rb') as f:
|
||||
while True:
|
||||
buf = f.read(hash_func.block_size)
|
||||
if buf == '':
|
||||
break
|
||||
hash_func.update(buf)
|
||||
f = open(pathname, 'rb')
|
||||
while True:
|
||||
buf = f.read(hash_func.block_size)
|
||||
if buf == '':
|
||||
break
|
||||
hash_func.update(buf)
|
||||
f.close()
|
||||
return hash_func.hexdigest() == digest
|
||||
return False
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user