Skip to content

Commit 3307e39

Browse files
committed
windows: upgrade libffi to 3.4.2
Impetus for this is it unblocks Windows ARM distributions. Unlike CPython, we ship libffi 3.4.2 on Python <3.11.
1 parent 98d2390 commit 3307e39

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

cpython-windows/build.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
"_bz2": {},
5252
"_ctypes": {
53-
"shared_depends": ["libffi-7"],
53+
"shared_depends": ["libffi-8"],
5454
"static_depends_no_project": ["libffi"],
5555
},
5656
"_decimal": {},
@@ -812,13 +812,28 @@ def hack_props(
812812

813813
libffi_props = pcbuild_path / "libffi.props"
814814

815+
# Always use libffi-8 / 3.4.2. (Python <= 3.11 use libffi-7 by default.)
816+
try:
817+
static_replace_in_file(
818+
libffi_props,
819+
br"""<_LIBFFIDLL Include="$(libffiOutDir)\libffi-7.dll" />""",
820+
br"""<_LIBFFIDLL Include="$(libffiOutDir)\libffi-8.dll" />""",
821+
)
822+
static_replace_in_file(
823+
libffi_props,
824+
br"<AdditionalDependencies>libffi-7.lib;%(AdditionalDependencies)</AdditionalDependencies>",
825+
br"<AdditionalDependencies>libffi-8.lib;%(AdditionalDependencies)</AdditionalDependencies>",
826+
)
827+
except NoSearchStringError:
828+
pass
829+
815830
if static:
816-
# For some reason the built .lib doesn't have the -7 suffix in
831+
# For some reason the built .lib doesn't have the -8 suffix in
817832
# static build mode. This is possibly a side-effect of CPython's
818833
# libffi build script not officially supporting static-only builds.
819834
static_replace_in_file(
820835
libffi_props,
821-
b"<AdditionalDependencies>libffi-7.lib;%(AdditionalDependencies)</AdditionalDependencies>",
836+
b"<AdditionalDependencies>libffi-8.lib;%(AdditionalDependencies)</AdditionalDependencies>",
822837
b"<AdditionalDependencies>libffi.lib;%(AdditionalDependencies)</AdditionalDependencies>",
823838
)
824839

@@ -1593,7 +1608,7 @@ def build_libffi(
15931608
"-c",
15941609
"core.autocrlf=input",
15951610
"checkout",
1596-
"ed22026f39b37f892ded95d7b30e77dfb5126334",
1611+
"16fad4855b3d8c03b5910e405ff3a04395b39a98",
15971612
],
15981613
cwd=ffi_source_path,
15991614
check=True,

src/validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const PE_ALLOWED_LIBRARIES: &[&str] = &[
9393
// Our libraries.
9494
"libcrypto-1_1.dll",
9595
"libcrypto-1_1-x64.dll",
96-
"libffi-7.dll",
96+
"libffi-8.dll",
9797
"libssl-1_1.dll",
9898
"libssl-1_1-x64.dll",
9999
"python3.dll",

0 commit comments

Comments
 (0)