From 5224df54c57a34c62d688660fc3c8e14812a5185 Mon Sep 17 00:00:00 2001 From: lazerg Date: Sat, 19 Sep 2026 01:44:50 +0500 Subject: [PATCH] gh-157763: Fix ctypes.util.test() on Windows --- Lib/ctypes/util.py | 2 +- .../next/Library/2026-09-19-11-40-12.gh-issue-157763.Kq3vBd.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2026-09-19-11-40-12.gh-issue-157763.Kq3vBd.rst diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py index 2b01506f3d4ffab..a37575e5f012ae2 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -532,7 +532,7 @@ def test(): from ctypes import cdll if os.name == "nt": print(cdll.msvcrt) - print(cdll.load("msvcrt")) + print(cdll.LoadLibrary("msvcrt")) print(find_library("msvcrt")) if os.name == "posix": diff --git a/Misc/NEWS.d/next/Library/2026-09-19-11-40-12.gh-issue-157763.Kq3vBd.rst b/Misc/NEWS.d/next/Library/2026-09-19-11-40-12.gh-issue-157763.Kq3vBd.rst new file mode 100644 index 000000000000000..bfbabdde3b649a5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-09-19-11-40-12.gh-issue-157763.Kq3vBd.rst @@ -0,0 +1,2 @@ +``ctypes.util.test()`` now calls ``cdll.LoadLibrary()`` on Windows instead of +the nonexistent ``cdll.load()``.