Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add test for ctypes.CDLL incorrectly picking up builtin extens…
…ion libraries On linux and macOS, some of the built-ins are provided as extensions (e.g., _sha1.cpython-39-x86_64-linux-gnu.so) that originally reside in python3.X/lib-dynload directory. This directory is not in the ctypes' library search path, therefore running ctypes.CDLL('_sha1.cpython-39-x86_64-linux-gnu.so') in python interpreter will come up empty. In a frozen application, however, these extensions end up collected directly into _MEIPASS, which is searched by ctypes (because search behavior is explicitly overriden by the hook). Therefore, trying to load the extension's library file via ctypes.CDLL() will succeed, resultingin inconsistent behavior between unfrozen and frozen program. On macOS, this causes issues with `pycryptodomex` (pyinstaller#5583), which, due to its library search implementation, ends up with handle of `_sha1` extension module instead of its private extension/library with the same name prefix.
- Loading branch information