From: Carlo Bramini Date: Fri, 15 May 2026 14:29:26 +0000 (+0200) Subject: gh-149831: Fix ctypes DLL library name on Cygwin (#149832) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=50aff5fc5ccc5b7c64ad5dcbf2a2d125436b85a0;p=thirdparty%2FPython%2Fcpython.git gh-149831: Fix ctypes DLL library name on Cygwin (#149832) Co-authored-by: Victor Stinner --- 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)