GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Wrong ctypes DLL library name for CYGWIN. · Issue #149831 · python/cpython

Wrong ctypes DLL library name for CYGWIN. #149831

New issue
Copy link
New issue
Copy link
Closed
Closed
Wrong ctypes DLL library name for CYGWIN.#149831
Copy link
Labels
OS-unsupportedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@carlo-bramini
carlo-bramini
opened on May 14, 2026
Issue body actions

Bug report

Bug description:

While running make test on CYGWIN to verify how the support for this platform is good, I found several messages like this one:

test test_ssl crashed -- Traceback (most recent call last):
  File "/home/carlo/packages/python/cpython/Lib/test/libregrtest/single.py", line 210, in _runtest_env_changed_exc
    _load_run_test(result, runtests)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/home/carlo/packages/python/cpython/Lib/test/libregrtest/single.py", line 155, in _load_run_test
    test_mod = importlib.import_module(module_name)
  File "/home/carlo/packages/python/cpython/Lib/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1346, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1305, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 915, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 747, in exec_module
  File "<frozen importlib._bootstrap>", line 549, in _call_with_frames_removed
  File "/home/carlo/packages/python/cpython/Lib/test/test_ssl.py", line 37, in <module>
    import ctypes
  File "/home/carlo/packages/python/cpython/Lib/ctypes/__init__.py", line 555, in <module>
    pythonapi = PyDLL(_sysconfig.get_config_var("LDLIBRARY"))
  File "/home/carlo/packages/python/cpython/Lib/ctypes/__init__.py", line 422, in __init__
    self._handle = self._load_library(name, mode, handle, winmode)
                   ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/carlo/packages/python/cpython/Lib/ctypes/__init__.py", line 464, in _load_library
    return _dlopen(name, mode)
OSError: Permission denied

So, I added a change immediately before this line:

cpython/Lib/ctypes/__init__.py

Line 464 in c6f7368

return _dlopen(name, mode)

and I added this code for debugging:

print(f"DEBUG: name={name}, mode={mode}")

Next, I restarted the tests and this message has been printed on the console:

DEBUG: name=libpython3.16.dll.a, mode=0

It is quite obvious that dlopen() from the POSIX layer or the Windows API LoadLibrary() will be never able to load it because this is the import library, not the shared library.
Actually, by looking the error message, it is using LDLIBRARY for retrieving the name of the library, but this is not the right choice for the platform.
Instead, the right value to be used here seems to be DLLLIBRARY instead.
So, I did a fix again into ctype/__init__.py for supporting CYGWIN.

After the fix, my debug code prints this line on the console:

DEBUG: name=cygpython3.16.dll, mode=0

and that test has been passed successfully.
After running the whole testsuite, the number of failing tests decreased from 84 to 69.

I also left the constructs _sys.platform in ["android"]: and sys.platform in ["cygwin"]: to be ready for accepting other platforms: in my opinion, MinGW/MSYS2 will need to be added near to CYGWIN too, but perhaps something else may need to be also added near Android in the future.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

  • gh-149831: Fix ctypes wrong DLL library name for CYGWIN. #149832

Activity

  1. carlo-bramini
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on May 14, 2026
  2. carlo-bramini
    changed the title [-]Fix wrong DLL library name for CYGWIN.[/-] [+]Wrong DLL library name for CYGWIN.[/+] on May 14, 2026
  3. carlo-bramini
    added a commit that references this issue on May 14, 2026

    pythongh-149831: fix wrong DLL library name for CYGWIN.

    98c5876
  4. encukou
    added
    OS-unsupported
    on May 14, 2026
  5. github-project-automation
    added this to Unsupported platformson May 14, 2026
  6. vstinner
    added a parent issue on May 15, 2026
    • Enhance Cygwin support #149879
  7. vstinner
    changed the title [-]Wrong DLL library name for CYGWIN.[/-] [+]Wrong ctypes DLL library name for CYGWIN.[/+] on May 15, 2026
  8. vstinner
    added a commit that references this issue on May 15, 2026

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

    50aff5f
  9. vstinner
    closed this as completedon May 15, 2026
  10. github-project-automation
    moved this to Done in Unsupported platformson May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-unsupportedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • Unsupported platforms
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.