From 01f963171359fb8517c38c36efdadc4af98c4f23 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 4 Nov 2022 18:32:46 -0700 Subject: [PATCH 1/2] socket: constructor accepts bytes on Windows https://github.com/python/cpython/blob/d04899abb0da4cc7c0a390f5bc52d57ace8955fd/Modules/socketmodule.c#L5318 This is used in `socket.fromshare`. It must be bytes, not some other buffer. --- stdlib/_socket.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdlib/_socket.pyi b/stdlib/_socket.pyi index df6b45a2d394..6d5600427204 100644 --- a/stdlib/_socket.pyi +++ b/stdlib/_socket.pyi @@ -583,7 +583,10 @@ class socket: def proto(self) -> int: ... @property def timeout(self) -> float | None: ... - def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | None = ...) -> None: ... + if sys.platform == "win32": + def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | bytes | None = ...) -> None: ... + else: + def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | None = ...) -> None: ... def bind(self, __address: _Address) -> None: ... def close(self) -> None: ... def connect(self, __address: _Address) -> None: ... From b72cd62358019fef3410adfd00654ce4cf495b55 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 5 Nov 2022 01:34:47 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/_socket.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/_socket.pyi b/stdlib/_socket.pyi index 6d5600427204..f7b0e6901bf4 100644 --- a/stdlib/_socket.pyi +++ b/stdlib/_socket.pyi @@ -587,6 +587,7 @@ class socket: def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | bytes | None = ...) -> None: ... else: def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | None = ...) -> None: ... + def bind(self, __address: _Address) -> None: ... def close(self) -> None: ... def connect(self, __address: _Address) -> None: ...