Mercurial > public > mercurial-scm > hg
diff mercurial/cffi/bdiff.py @ 51786:ecc3a893979d stable
cffi: pass C type and attribute names as str instead of bytes
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Mon, 05 Aug 2024 21:08:36 +0200 |
parents | 594fc56c0af7 |
children | 6d7fdf90aa96 |
line wrap: on
line diff
--- a/mercurial/cffi/bdiff.py Mon Aug 05 20:47:17 2024 +0200 +++ b/mercurial/cffi/bdiff.py Mon Aug 05 21:08:36 2024 +0200 @@ -21,11 +21,11 @@ def blocks(sa: bytes, sb: bytes) -> List[Tuple[int, int, int, int]]: - a = ffi.new(b"struct bdiff_line**") - b = ffi.new(b"struct bdiff_line**") - ac = ffi.new(b"char[]", str(sa)) - bc = ffi.new(b"char[]", str(sb)) - l = ffi.new(b"struct bdiff_hunk*") + a = ffi.new("struct bdiff_line**") + b = ffi.new("struct bdiff_line**") + ac = ffi.new("char[]", str(sa)) + bc = ffi.new("char[]", str(sb)) + l = ffi.new("struct bdiff_hunk*") try: an = lib.bdiff_splitlines(ac, len(sa), a) bn = lib.bdiff_splitlines(bc, len(sb), b) @@ -49,11 +49,11 @@ def bdiff(sa: bytes, sb: bytes) -> bytes: - a = ffi.new(b"struct bdiff_line**") - b = ffi.new(b"struct bdiff_line**") - ac = ffi.new(b"char[]", str(sa)) - bc = ffi.new(b"char[]", str(sb)) - l = ffi.new(b"struct bdiff_hunk*") + a = ffi.new("struct bdiff_line**") + b = ffi.new("struct bdiff_line**") + ac = ffi.new("char[]", str(sa)) + bc = ffi.new("char[]", str(sb)) + l = ffi.new("struct bdiff_hunk*") try: an = lib.bdiff_splitlines(ac, len(sa), a) bn = lib.bdiff_splitlines(bc, len(sb), b)