Skip to content

[codex] Switch httpx timeout handling to match#3011

Merged
adamtheturtle merged 6 commits into
mainfrom
adamtheturtle/issue-2960
May 19, 2026
Merged

[codex] Switch httpx timeout handling to match#3011
adamtheturtle merged 6 commits into
mainfrom
adamtheturtle/issue-2960

Conversation

@adamtheturtle
Copy link
Copy Markdown
Member

@adamtheturtle adamtheturtle commented May 19, 2026

Switches the duplicated isinstance(..., tuple) timeout branches in the sync and async HTTPX transports to match statements.

This keeps the timeout construction local to each transport while preserving tuple-specific connect/read values and scalar float/int behavior.

Closes #2960.

Validated with focused transport tests, full 100% coverage, and ruff, mypy, pyright, pyrefly, and ty checks.


Note

Low Risk
Low risk refactor limited to timeout construction in HTTPXTransport/AsyncHTTPXTransport, with added tests covering integer timeouts to guard behavior.

Overview
Refactors HTTPXTransport and AsyncHTTPXTransport timeout handling by replacing duplicated isinstance(..., tuple) branching with a match statement that distinguishes (connect, read) tuples from scalar timeouts.

Adds new sync/async transport tests to explicitly verify that integer request_timeout values are accepted and still produce successful requests.

Reviewed by Cursor Bugbot for commit 7e3c00f. Bugbot is set up for automated code reviews on this repo. Configure here.

@adamtheturtle adamtheturtle changed the title [codex] Deduplicate httpx timeout construction [codex] Switch httpx timeout handling to match May 19, 2026
@adamtheturtle adamtheturtle marked this pull request as ready for review May 19, 2026 12:08
@adamtheturtle adamtheturtle merged commit 8db0c59 into main May 19, 2026
16 checks passed
@adamtheturtle adamtheturtle deleted the adamtheturtle/issue-2960 branch May 19, 2026 12:25
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.

Deduplicate httpx Timeout construction with match helper in transports

1 participant