Skip to content

Commit 4d2f8b7

Browse files
committed
Ensures the hasher content is bytes
1 parent 8da4a00 commit 4d2f8b7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

coverage/data.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,12 @@ def combine_parallel_data(
162162

163163
with open(f, "rb") as fobj:
164164
hasher = hashlib.new("sha3_256", usedforsecurity=False)
165-
hasher.update(fobj.read())
165+
content = fobj.read()
166+
167+
# Ensure content is bytes before hashing
168+
if isinstance(content, str):
169+
content = content.encode('utf-8')
170+
hasher.update(content)
166171
sha = hasher.digest()
167172
combine_this_one = sha not in file_hashes
168173

0 commit comments

Comments
 (0)