diff mercurial/cffi/mpatch.py @ 51673: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 94a797032fc4
children 472699b5ddb3
line wrap: on
line diff
--- a/mercurial/cffi/mpatch.py	Mon Aug 05 20:47:17 2024 +0200
+++ b/mercurial/cffi/mpatch.py	Mon Aug 05 21:08:36 2024 +0200
@@ -19,8 +19,8 @@
 @ffi.def_extern()
 def cffi_get_next_item(arg, pos):
     all, bins = ffi.from_handle(arg)
-    container = ffi.new(b"struct mpatch_flist*[1]")
-    to_pass = ffi.new(b"char[]", str(bins[pos]))
+    container = ffi.new("struct mpatch_flist*[1]")
+    to_pass = ffi.new("char[]", str(bins[pos]))
     all.append(to_pass)
     r = lib.mpatch_decode(to_pass, len(to_pass) - 1, container)
     if r < 0:
@@ -41,7 +41,7 @@
     if outlen < 0:
         lib.mpatch_lfree(patch)
         raise mpatchError(b"inconsistency detected")
-    buf = ffi.new(b"char[]", outlen)
+    buf = ffi.new("char[]", outlen)
     if lib.mpatch_apply(buf, text, len(text), patch) < 0:
         lib.mpatch_lfree(patch)
         raise mpatchError(b"error applying patches")