From 1802abfbf1036088a0a5282abb04ae0b76cc133a Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 26 Sep 2026 21:35:13 +0300 Subject: [PATCH 1/2] Fix test_embeddable on MinGW --- Tests/test_image_access.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Tests/test_image_access.py b/Tests/test_image_access.py index ee8a92d5eaf..7e1033b8b8b 100644 --- a/Tests/test_image_access.py +++ b/Tests/test_image_access.py @@ -306,7 +306,15 @@ def test_embeddable(self) -> None: """) objects = compiler.compile(["embed_pil.c"]) - compiler.link_executable(objects, "embed_pil") + libraries = [] + if compiler.compiler_type == "mingw32": + # MSVC links the Python library automatically via a pragma in + # pyconfig.h, but MinGW needs it to be passed explicitly + libraries.append( + f"python{sys.version_info.major}.{sys.version_info.minor}" + + getattr(sys, "abiflags", "") + ) + compiler.link_executable(objects, "embed_pil", libraries=libraries) env = os.environ.copy() env["PATH"] = sys.prefix + ";" + env["PATH"] From 8034559354cb4d9d98b16a9a0fae6b0f4cb783f5 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sun, 27 Sep 2026 23:03:30 +1000 Subject: [PATCH 2/2] Use simpler library name --- Tests/test_image_access.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Tests/test_image_access.py b/Tests/test_image_access.py index 7e1033b8b8b..ceee458c2d8 100644 --- a/Tests/test_image_access.py +++ b/Tests/test_image_access.py @@ -310,10 +310,7 @@ def test_embeddable(self) -> None: if compiler.compiler_type == "mingw32": # MSVC links the Python library automatically via a pragma in # pyconfig.h, but MinGW needs it to be passed explicitly - libraries.append( - f"python{sys.version_info.major}.{sys.version_info.minor}" - + getattr(sys, "abiflags", "") - ) + libraries.append("python3") compiler.link_executable(objects, "embed_pil", libraries=libraries) env = os.environ.copy()