python-trio / python-trio/trio

ModuleNotFoundError if _ssl module is unavailable

Open
#1,740 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.3k
Forks
431
Avg merge
2d 17h
Merged PRs (30d)
6

Description

The _ssl module is optional in Python, ie. building Python succeeds if TLS libraries are unavailable.

Trio attempts to import ssl at import time, meaning that trio is unusable if Python is not built with TLS support; importing it fails with the error

ModuleNotFoundError: No module named '_ssl'

Simply suppressing the ImportError in trio._ssl and trio._highlevel_ssl_helpers addresses this, allowing it to fail only if you try to use SSL functionality.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with trio._ssl and trio._highlevel_ssl_helpers, where the issue says importing ssl currently fails when Python lacks the optional _ssl module. Check the import behavior in an environment without TLS support, then verify that Trio still imports while SSL functionality fails only when used.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking, security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.