storage: use bytes when reading chunks (#36515)

This commit is contained in:
Frédéric Péters 2019-11-12 23:37:02 +01:00
parent 5da68239d3
commit fd88b46128
2 changed files with 2 additions and 2 deletions

View File

@ -547,7 +547,7 @@ def file_digest(content, chunk_size=100000):
def read_chunk():
return content.read(chunk_size)
for chunk in iter(read_chunk, ''):
for chunk in iter(read_chunk, b''):
digest.update(chunk)
return digest.hexdigest()

View File

@ -76,7 +76,7 @@ def atomic_write(path, content, async_op=False):
# file pointer
def read100k():
return content.read(100000)
for piece in iter(read100k, ''):
for piece in iter(read100k, b''):
f.write(piece)
else:
f.write(content)