https://github.com/python/cpython/commit/50aff5fc5ccc5b7c64ad5dcbf2a2d125436b85a0
commit: 50aff5fc5ccc5b7c64ad5dcbf2a2d125436b85a0
branch: main
author: Carlo Bramini <[email protected]>
committer: vstinner <[email protected]>
date: 2026-05-15T14:29:26Z
summary:

gh-149831: Fix ctypes DLL library name on Cygwin (#149832)

Co-authored-by: Victor Stinner <[email protected]>

files:
M Lib/ctypes/__init__.py

diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
index 0b84a27f8c6d61..890168cc9809fd 100644
--- a/Lib/ctypes/__init__.py
+++ b/Lib/ctypes/__init__.py
@@ -549,9 +549,11 @@ def LoadLibrary(self, name):
 
 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)
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to