Patchwork [stable] cffi: fix build on Python 3

login
register
mail settings
Submitter Manuel Jacob
Date Nov. 17, 2019, 6:57 p.m.
Message ID <ef297356c8605f036417.1574017028@tmp>
Download mbox | patch
Permalink /patch/43325/
State Accepted
Headers show

Comments

Manuel Jacob - Nov. 17, 2019, 6:57 p.m.
# HG changeset patch
# User Manuel Jacob <me@manueljacob.de>
# Date 1574016901 -3600
#      Sun Nov 17 19:55:01 2019 +0100
# Branch stable
# Node ID ef297356c8605f036417f7b839c87ba8f9ffad07
# Parent  856cce0c255cc6ffbe164764cc152e3011c59fd7
cffi: fix build on Python 3

CFFI expects the arguments to be of type str, which means that the string
literals should not have the `b` prefix.
Yuya Nishihara - Nov. 18, 2019, 2:15 p.m.
On Sun, 17 Nov 2019 19:57:08 +0100, Manuel Jacob wrote:
> # HG changeset patch
> # User Manuel Jacob <me@manueljacob.de>
> # Date 1574016901 -3600
> #      Sun Nov 17 19:55:01 2019 +0100
> # Branch stable
> # Node ID ef297356c8605f036417f7b839c87ba8f9ffad07
> # Parent  856cce0c255cc6ffbe164764cc152e3011c59fd7
> cffi: fix build on Python 3

Queued for stable, thanks.

Patch

diff --git a/mercurial/cffi/bdiffbuild.py b/mercurial/cffi/bdiffbuild.py
--- a/mercurial/cffi/bdiffbuild.py
+++ b/mercurial/cffi/bdiffbuild.py
@@ -5,10 +5,10 @@ 
 
 ffi = cffi.FFI()
 with open(
-    os.path.join(os.path.join(os.path.dirname(__file__), b'..'), b'bdiff.c')
+    os.path.join(os.path.join(os.path.dirname(__file__), '..'), 'bdiff.c')
 ) as f:
     ffi.set_source(
-        b"mercurial.cffi._bdiff", f.read(), include_dirs=[b'mercurial']
+        "mercurial.cffi._bdiff", f.read(), include_dirs=['mercurial']
     )
 ffi.cdef(
     """
diff --git a/mercurial/cffi/mpatchbuild.py b/mercurial/cffi/mpatchbuild.py
--- a/mercurial/cffi/mpatchbuild.py
+++ b/mercurial/cffi/mpatchbuild.py
@@ -5,11 +5,11 @@ 
 
 ffi = cffi.FFI()
 mpatch_c = os.path.join(
-    os.path.join(os.path.dirname(__file__), b'..', b'mpatch.c')
+    os.path.join(os.path.dirname(__file__), '..', 'mpatch.c')
 )
 with open(mpatch_c) as f:
     ffi.set_source(
-        b"mercurial.cffi._mpatch", f.read(), include_dirs=[b"mercurial"]
+        "mercurial.cffi._mpatch", f.read(), include_dirs=["mercurial"]
     )
 ffi.cdef(
     """
diff --git a/mercurial/cffi/osutilbuild.py b/mercurial/cffi/osutilbuild.py
--- a/mercurial/cffi/osutilbuild.py
+++ b/mercurial/cffi/osutilbuild.py
@@ -4,7 +4,7 @@ 
 
 ffi = cffi.FFI()
 ffi.set_source(
-    b"mercurial.cffi._osutil",
+    "mercurial.cffi._osutil",
     """
 #include <sys/attr.h>
 #include <sys/vnode.h>
@@ -22,7 +22,7 @@ 
     off_t             datalength;
 } __attribute__((aligned(4), packed)) val_attrs_t;
 """,
-    include_dirs=[b'mercurial'],
+    include_dirs=['mercurial'],
 )
 ffi.cdef(
     '''