mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-07 23:11:29 +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:
|
if os.path.getsize(pathname) != size:
|
||||||
return False
|
return False
|
||||||
hash_func = getattr(hashlib, alg)()
|
hash_func = getattr(hashlib, alg)()
|
||||||
with open(pathname, 'rb') as f:
|
f = open(pathname, 'rb')
|
||||||
while True:
|
while True:
|
||||||
buf = f.read(hash_func.block_size)
|
buf = f.read(hash_func.block_size)
|
||||||
if buf == '':
|
if buf == '':
|
||||||
break
|
break
|
||||||
hash_func.update(buf)
|
hash_func.update(buf)
|
||||||
|
f.close()
|
||||||
return hash_func.hexdigest() == digest
|
return hash_func.hexdigest() == digest
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user