Title: ctypes.util.test() calls cdll.load, which LibraryLoader does not have · Issue #157763 · python/cpython · GitHub
Open Graph Title: ctypes.util.test() calls cdll.load, which LibraryLoader does not have · Issue #157763 · python/cpython
X Title: ctypes.util.test() calls cdll.load, which LibraryLoader does not have · Issue #157763 · python/cpython
Description: Bug report ctypes.util.test() calls cdll.load(...), which LibraryLoader does not have, so the self-test raises on Windows. Where: Lib/ctypes/util.py, test() (line 535 on main), the Windows branch: if os.name == "nt": print(cdll.msvcrt) p...
Open Graph Description: Bug report ctypes.util.test() calls cdll.load(...), which LibraryLoader does not have, so the self-test raises on Windows. Where: Lib/ctypes/util.py, test() (line 535 on main), the Windows branch: ...
X Description: Bug report ctypes.util.test() calls cdll.load(...), which LibraryLoader does not have, so the self-test raises on Windows. Where: Lib/ctypes/util.py, test() (line 535 on main), the Windows branch: ...
Opengraph URL: https://github.com/python/cpython/issues/157763
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ctypes.util.test() calls cdll.load, which LibraryLoader does not have","articleBody":"# Bug report\n\n`ctypes.util.test()` calls `cdll.load(...)`, which `LibraryLoader` does not have, so the self-test raises on Windows.\n\n**Where:** `Lib/ctypes/util.py`, `test()` (line 535 on `main`), the Windows branch:\n\n```python\nif os.name == \"nt\":\n print(cdll.msvcrt)\n print(cdll.load(\"msvcrt\"))\n```\n\n`LibraryLoader` defines `LoadLibrary`, not `load`, and its `__getattr__` turns the unknown name into an `AttributeError`.\n\n**Reproduce** (Windows, 3.13.5; the line is the same on `main`, whose `util.py` already needs 3.15 syntax to import):\n\n```\n> python -c \"import ctypes.util; ctypes.util.test()\"\n\u003cCDLL 'msvcrt', handle 7ffd0a0b0000 at 0x...>\nAttributeError: load\n```\n\n**Proposed fix:**\n\n```diff\n- print(cdll.load(\"msvcrt\"))\n+ print(cdll.LoadLibrary(\"msvcrt\"))\n```\n\nChecked by running `test()` on Windows against 3.13.5's `util.py`: the current code raises `AttributeError: load`; the fixed code completes and prints the loaded CDLL.\n\n**Environment:** Windows 11, CPython 3.13.5.\n\n---\n\nFound while auditing installed code with a verification tool I am building; the reproduction above was run on the version named, and the proposed fix was applied to a local copy and run as well. Report drafted with AI assistance.\n\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-157770\n* gh-157776\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/tony-CloseAI","@type":"Person","name":"tony-CloseAI"},"datePublished":"2026-09-18T17:53:22Z","url":"https://github.com/python/cpython/issues/157763"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bab5875a-e3cf-5aea-d86b-a8f3c2de7530 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D38E:3DD488:3A62FC1:4A35EC4:6B02026B |
| html-safe-nonce | 90d66117855588089e3f3b6fda6751a7ddb4b5d01a66096887847e01476ebd82 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzhFOjNERDQ4ODozQTYyRkMxOjRBMzVFQzQ6NkIwMjAyNkIiLCJ2aXNpdG9yX2lkIjoiODI3OTc1MzUxMTY3MjA4NzE0NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f334b46366a6949b114eb059270da0076c7ec2fbafa181a80e12928b42dd1fa7 |
| hovercard-subject-tag | issue:5502860321 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/157763/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2b4f194599fd9664b2a006702d43945fcf888cf58442e9c3954107c27c10235f/python/cpython/issues/157763 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2b4f194599fd9664b2a006702d43945fcf888cf58442e9c3954107c27c10235f/python/cpython/issues/157763 |
| og:image:alt | Bug report ctypes.util.test() calls cdll.load(...), which LibraryLoader does not have, so the self-test raises on Windows. Where: Lib/ctypes/util.py, test() (line 535 on main), the Windows branch: ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tony-CloseAI |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width