Skip to content

[PySocks] Correct timeout and optional socket error types - #16797

Merged
srittau merged 2 commits into
python:mainfrom
iamabhisheknag:fix/pysocks-timeout-error-types
Nov 14, 2026
Merged

srittau merged 2 commits into
python:mainfrom
iamabhisheknag:fix/pysocks-timeout-error-types

Conversation

@iamabhisheknag

Copy link
Copy Markdown
Contributor

Accept fractional seconds for create_connection(timeout=...) and allow None for ProxyError.socket_err, matching the upstream implementation and runtime behavior in PySocks 1.7.1.

AI assistance: OpenAI coding assistant (GPT-6).

@github-actions

This comment has been minimized.

Comment thread stubs/PySocks/socks.pyi Outdated
def create_connection(
dest_pair: _Endpoint,
timeout: int | None = None,
timeout: float | None = None,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

According to our new policy:

Suggested change
timeout: float | None = None,
timeout: float | int | None = None,

@github-actions

Copy link
Copy Markdown
Contributor

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

urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/contrib/socks.py:118: error: Unused "type: ignore" comment  [unused-ignore]

@srittau
srittau merged commit 983d92a into python:main Nov 14, 2026
74 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