Skip to content

Commit 87e7d5e

Browse files
cliffhallclaude
andcommitted
fix(fetch): clear the Python 3.11 pyupgrade findings in the pinning code
ruff takes its target from requires-python, which is now >=3.11.5, so UP041 and UP017 apply to fetch. Catch the builtin TimeoutError (which asyncio.TimeoutError has aliased since 3.11) and use datetime.UTC. No behavior change. Closes #5569 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
1 parent aef8fd7 commit 87e7d5e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/fetch/src/mcp_server_fetch/pinning.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ async def connect_tcp(
100100
except socket.gaierror as e:
101101
# What the inner backend reports for a name it cannot resolve.
102102
raise httpcore.ConnectError(str(e)) from e
103-
except asyncio.TimeoutError as e:
103+
except TimeoutError as e:
104104
raise httpcore.ConnectTimeout(f"Timed out resolving {host}") from e
105105
# getaddrinfo lists an address once per socket type.
106106
addresses = list(dict.fromkeys(resolved))

‎src/fetch/tests/test_pinning.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def _issue(
241241
ca: bool,
242242
names: Sequence[x509.GeneralName],
243243
) -> x509.Certificate:
244-
now = datetime.datetime.now(datetime.timezone.utc)
244+
now = datetime.datetime.now(datetime.UTC)
245245
builder = (
246246
x509.CertificateBuilder()
247247
.subject_name(subject)

0 commit comments

Comments
 (0)