diff --git a/Tests/test_image_access.py b/Tests/test_image_access.py index ee8a92d5eaf..ceee458c2d8 100644 --- a/Tests/test_image_access.py +++ b/Tests/test_image_access.py @@ -306,7 +306,12 @@ 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("python3") + compiler.link_executable(objects, "embed_pil", libraries=libraries) env = os.environ.copy() env["PATH"] = sys.prefix + ";" + env["PATH"]