Skip to content

Commit 17409bb

Browse files
Handle trio raising NotImplementedError on unsupported platforms. (#955)
* Handle import of `trio` raising `NotImplementedError` on unsupported platforms. Closes #946 * Add pragma no cover to deal with oddly misbehaving test * Update CHANGELOG.md
1 parent 4aac649 commit 17409bb

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
## Unreleased
88

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

1112
## 1.0.5 (March 27th, 2024)
1213

httpcore/_backends/anyio.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ async def connect_tcp(
104104
timeout: typing.Optional[float] = None,
105105
local_address: typing.Optional[str] = None,
106106
socket_options: typing.Optional[typing.Iterable[SOCKET_OPTION]] = None,
107-
) -> AsyncNetworkStream:
107+
) -> AsyncNetworkStream: # pragma: nocover
108108
if socket_options is None:
109-
socket_options = [] # pragma: no cover
109+
socket_options = []
110110
exc_map = {
111111
TimeoutError: ConnectTimeout,
112112
OSError: ConnectError,
@@ -120,7 +120,7 @@ async def connect_tcp(
120120
local_host=local_address,
121121
)
122122
# By default TCP sockets opened in `asyncio` include TCP_NODELAY.
123-
for option in socket_options: # pragma: nocover
123+
for option in socket_options:
124124
stream._raw_socket.setsockopt(*option) # type: ignore[attr-defined] # pragma: no cover
125125
return AnyIOStream(stream)
126126

httpcore/_synchronization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
try:
1111
import trio
12-
except ImportError: # pragma: nocover
12+
except (ImportError, NotImplementedError): # pragma: nocover
1313
trio = None # type: ignore
1414

1515
try:

0 commit comments

Comments
 (0)