From 50aff5fc5ccc5b7c64ad5dcbf2a2d125436b85a0 Mon Sep 17 00:00:00 2001 From: Carlo Bramini Date: Fri, 15 May 2026 16:29:26 +0200 Subject: [PATCH] gh-149831: Fix ctypes DLL library name on Cygwin (#149832) Co-authored-by: Victor Stinner --- Lib/ctypes/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py index 0b84a27f8c6d..890168cc9809 100644 --- a/Lib/ctypes/__init__.py +++ b/Lib/ctypes/__init__.py @@ -549,9 +549,11 @@ pydll = LibraryLoader(PyDLL) if _os.name == "nt": pythonapi = PyDLL("python dll", None, _sys.dllhandle) -elif _sys.platform in ["android", "cygwin"]: +elif _sys.platform == "android": # These are Unix-like platforms which use a dynamically-linked libpython. pythonapi = PyDLL(_sysconfig.get_config_var("LDLIBRARY")) +elif _sys.platform == "cygwin": + pythonapi = PyDLL(_sysconfig.get_config_var("DLLLIBRARY")) else: pythonapi = PyDLL(None) -- 2.47.3