--- a/mercurial/patch.py Tue Dec 01 01:18:21 2020 -0500
+++ b/mercurial/patch.py Sat Nov 28 11:15:54 2020 +0900
@@ -2731,8 +2731,8 @@
def diffsinglehunkinline(hunklines):
"""yield tokens for a list of lines in a single hunk, with inline colors"""
# prepare deleted, and inserted content
- a = b''
- b = b''
+ a = bytearray()
+ b = bytearray()
for line in hunklines:
if line[0:1] == b'-':
a += line[1:]
@@ -2746,8 +2746,8 @@
yield t
return
# re-split the content into words
- al = wordsplitter.findall(a)
- bl = wordsplitter.findall(b)
+ al = wordsplitter.findall(bytes(a))
+ bl = wordsplitter.findall(bytes(b))
# re-arrange the words to lines since the diff algorithm is line-based
aln = [s if s == b'\n' else s + b'\n' for s in al]
bln = [s if s == b'\n' else s + b'\n' for s in bl]