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:
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.
Activity
pythongh-149831: fix wrong DLL library name for CYGWIN.
gh-149831: Fix ctypes DLL library name on Cygwin (#149832)