Skip to content

Fix return type of requests.utils.select_proxy#15777

Open
mrhx01 wants to merge 4 commits into
python:mainfrom
mrhx01:main
Open

Fix return type of requests.utils.select_proxy#15777
mrhx01 wants to merge 4 commits into
python:mainfrom
mrhx01:main

Conversation

@mrhx01
Copy link
Copy Markdown

@mrhx01 mrhx01 commented May 12, 2026

Fix type annotations in requests.utils.

This PR fixes two inconsistencies between the runtime implementation and the typeshed stubs:

  1. select_proxy may return None when no matching proxy is found, so the return type should be str | None.

  2. should_bypass_proxies accepts str | None for the no_proxy parameter in the runtime implementation, but the stub currently annotates it as Iterable[str] | None.

These changes align the stubs with the actual runtime behavior.

@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

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.

1 participant