diff --git a/stdlib/_zstd.pyi b/stdlib/_zstd.pyi index 2730232528fc..cf75ad89a35f 100644 --- a/stdlib/_zstd.pyi +++ b/stdlib/_zstd.pyi @@ -45,9 +45,9 @@ class ZstdCompressor: CONTINUE: Final = 0 FLUSH_BLOCK: Final = 1 FLUSH_FRAME: Final = 2 - def __init__( + def __new__( self, level: int | None = None, options: Mapping[int, int] | None = None, zstd_dict: ZstdDict | None = None - ) -> None: ... + ) -> Self: ... def compress( self, /, data: ReadableBuffer, mode: _ZstdCompressorContinue | _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 0 ) -> bytes: ... @@ -58,7 +58,7 @@ class ZstdCompressor: @final class ZstdDecompressor: - def __init__(self, zstd_dict: ZstdDict | None = None, options: Mapping[int, int] | None = None) -> None: ... + def __new__(self, zstd_dict: ZstdDict | None = None, options: Mapping[int, int] | None = None) -> Self: ... def decompress(self, /, data: ReadableBuffer, max_length: int = -1) -> bytes: ... @property def eof(self) -> bool: ... @@ -69,7 +69,7 @@ class ZstdDecompressor: @final class ZstdDict: - def __init__(self, dict_content: bytes, /, *, is_raw: bool = False) -> None: ... + def __new__(self, dict_content: bytes, /, *, is_raw: bool = False) -> Self: ... def __len__(self, /) -> int: ... @property def as_digested_dict(self) -> tuple[Self, int]: ... diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index e41eb4c2b65d..8b433e09e811 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -169,10 +169,17 @@ class partialmethod(Generic[_T]): func: Callable[..., _T] | _Descriptor args: tuple[Any, ...] keywords: dict[str, Any] - @overload - def __init__(self, func: Callable[..., _T], /, *args: Any, **keywords: Any) -> None: ... - @overload - def __init__(self, func: _Descriptor, /, *args: Any, **keywords: Any) -> None: ... + if sys.version_info >= (3, 14): + @overload + def __new__(self, func: Callable[..., _T], /, *args: Any, **keywords: Any) -> Self: ... + @overload + def __new__(self, func: _Descriptor, /, *args: Any, **keywords: Any) -> Self: ... + else: + @overload + def __init__(self, func: Callable[..., _T], /, *args: Any, **keywords: Any) -> None: ... + @overload + def __init__(self, func: _Descriptor, /, *args: Any, **keywords: Any) -> None: ... + def __get__(self, obj: Any, cls: type[Any] | None = None) -> Callable[..., _T]: ... @property def __isabstractmethod__(self) -> bool: ... diff --git a/stdlib/mmap.pyi b/stdlib/mmap.pyi index 261a2bfdfc44..99a046a16229 100644 --- a/stdlib/mmap.pyi +++ b/stdlib/mmap.pyi @@ -33,7 +33,7 @@ PAGESIZE: Final[int] class mmap: if sys.platform == "win32": - def __init__(self, fileno: int, length: int, tagname: str | None = None, access: int = 0, offset: int = 0) -> None: ... + def __new__(self, fileno: int, length: int, tagname: str | None = None, access: int = 0, offset: int = 0) -> Self: ... else: if sys.version_info >= (3, 13): def __new__(