Skip to content

Conversation

filipsnastins
Copy link
Contributor

@filipsnastins filipsnastins commented Sep 12, 2025

Individual values of the timeout configuration tuple (connect timeout, read timeout) can be set to None, making the timeout indefinite.

Previously, only the read timeout could be set to None.

Individual values of the timeout configuration tuple (connect timeout, read timeout) can be set to None, making the timeout indefinite.
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/hybrid.py:508: error: Overlap between argument names and ** TypedDict items: "description", "name"  [misc]
+ discord/ext/commands/hybrid.py:508: error: Overlap between argument names and ** TypedDict items: "name", "description"  [misc]
- discord/ext/commands/hybrid.py:629: error: Overlap between argument names and ** TypedDict items: "name", "description"  [misc]
+ discord/ext/commands/hybrid.py:629: error: Overlap between argument names and ** TypedDict items: "description", "name"  [misc]

Copy link
Member

@brianschubert brianschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the calls, None does seem to be accepted in the first tuple entry:

And it works at runtime:

uv run -w 'requests==2.32.4' python -c 'import requests; r = requests.get("https://example.com", timeout=(None, 1)); print(r.status_code)'
200

I don't see anything contrary in the docs or in the original PR discussion (#7696).

So, LGTM! Thanks!

@brianschubert brianschubert changed the title requests: support None values in timeout configuration tuple [requests] Allow "connect" timeout to be None in timeout configuration tuple Sep 12, 2025
@brianschubert brianschubert merged commit 59c36c8 into python:main Sep 12, 2025
48 checks passed
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.

2 participants