Skip to content

Commit c7820b4

Browse files
socket: constructor accepts bytes on Windows (#9095)
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.
1 parent cc7ac01 commit c7820b4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stdlib/_socket.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,11 @@ class socket:
583583
def proto(self) -> int: ...
584584
@property
585585
def timeout(self) -> float | None: ...
586-
def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | None = ...) -> None: ...
586+
if sys.platform == "win32":
587+
def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | bytes | None = ...) -> None: ...
588+
else:
589+
def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | None = ...) -> None: ...
590+
587591
def bind(self, __address: _Address) -> None: ...
588592
def close(self) -> None: ...
589593
def connect(self, __address: _Address) -> None: ...

0 commit comments

Comments
 (0)