Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle trio raising NotImplementedError on unsupported platforms. #955

Merged
merged 4 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

- Handle `SSLError` exception. (#918)
- Handle `trio` raising `NotImplementedError` on unsupported platforms. (#955)
- Handle mapping `ssl.SSLError` to `httpcore.ConnectError`. (#918)

## 1.0.5 (March 27th, 2024)

Expand Down
6 changes: 3 additions & 3 deletions httpcore/_backends/anyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ async def connect_tcp(
timeout: typing.Optional[float] = None,
local_address: typing.Optional[str] = None,
socket_options: typing.Optional[typing.Iterable[SOCKET_OPTION]] = None,
) -> AsyncNetworkStream:
) -> AsyncNetworkStream: # pragma: nocover
if socket_options is None:
socket_options = [] # pragma: no cover
socket_options = []
exc_map = {
TimeoutError: ConnectTimeout,
OSError: ConnectError,
Expand All @@ -120,7 +120,7 @@ async def connect_tcp(
local_host=local_address,
)
# By default TCP sockets opened in `asyncio` include TCP_NODELAY.
for option in socket_options: # pragma: nocover
for option in socket_options:
stream._raw_socket.setsockopt(*option) # type: ignore[attr-defined] # pragma: no cover
return AnyIOStream(stream)

Expand Down
2 changes: 1 addition & 1 deletion httpcore/_synchronization.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

try:
import trio
except ImportError: # pragma: nocover
except (ImportError, NotImplementedError): # pragma: nocover
trio = None # type: ignore

try:
Expand Down
Loading