Skip to content

Commit 98c5876

Browse files
committed
gh-149831: fix wrong DLL library name for CYGWIN.
1 parent c6f7368 commit 98c5876

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/ctypes/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,13 @@ def LoadLibrary(self, name):
549549

550550
if _os.name == "nt":
551551
pythonapi = PyDLL("python dll", None, _sys.dllhandle)
552-
elif _sys.platform in ["android", "cygwin"]:
552+
elif _sys.platform in ["android"]:
553553
# These are Unix-like platforms which use a dynamically-linked libpython.
554554
pythonapi = PyDLL(_sysconfig.get_config_var("LDLIBRARY"))
555+
elif _sys.platform in ["cygwin"]:
556+
# These platforms must load the DLL file from DLLLIBRARY
557+
# and not the import library provided by LDLIBRARY.
558+
pythonapi = PyDLL(_sysconfig.get_config_var("DLLLIBRARY"))
555559
else:
556560
pythonapi = PyDLL(None)
557561

0 commit comments

Comments
 (0)