Skip to content

core: raise clear error when OpenSSL library is not found#318

Open
Bortlesboat wants to merge 2 commits into
petertodd:masterfrom
Bortlesboat:fix-windows-openssl-typeerror
Open

core: raise clear error when OpenSSL library is not found#318
Bortlesboat wants to merge 2 commits into
petertodd:masterfrom
Bortlesboat:fix-windows-openssl-typeerror

Conversation

@Bortlesboat

@Bortlesboat Bortlesboat commented Apr 6, 2026

Copy link
Copy Markdown

Summary

On Windows, every ctypes.util.find_library() candidate can return None. Passing that value directly to ctypes.cdll.LoadLibrary() raises a confusing TypeError.

Check the resolved path first and raise an actionable EnvironmentError explaining that OpenSSL must be installed and discoverable.

Fixes #316.

Verification

  • Added a subprocess regression that mocks every library lookup to None and asserts the exact public error.
  • python -m unittest bitcoin.tests.test_key -v — 2 passed.
  • Touched files compile successfully and the diff whitespace check passes.

On Windows, ctypes.util.find_library() can return None for all
candidate library names. Passing None to LoadLibrary() raises a
confusing TypeError. Check for None first and raise an EnvironmentError
with an actionable message instead.

Fixes petertodd#316
@Bortlesboat

Copy link
Copy Markdown
Author

Added an isolated subprocess regression for the missing-library path. It verifies that all failed lookups now produce the actionable EnvironmentError instead of reaching LoadLibrary(None); the full key test module passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError when OpenSSL library is not found on Windows

1 participant