From 878f0950daad577d24d7085a348ae5c83847e4bd Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 2 Nov 2022 10:52:55 +0300 Subject: [PATCH 1/2] codecs: improve bytes handling --- stdlib/codecs.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index a7b60e38df11..e01b9f308cc4 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -1,5 +1,5 @@ import types -from _typeshed import Self +from _typeshed import ReadableBuffer, Self from abc import abstractmethod from collections.abc import Callable, Generator, Iterable from typing import Any, BinaryIO, Protocol, TextIO @@ -173,7 +173,7 @@ class IncrementalDecoder: errors: str def __init__(self, errors: str = ...) -> None: ... @abstractmethod - def decode(self, input: bytes, final: bool = ...) -> str: ... + def decode(self, input: ReadableBuffer, final: bool = ...) -> str: ... def reset(self) -> None: ... def getstate(self) -> tuple[bytes, int]: ... def setstate(self, state: tuple[bytes, int]) -> None: ... @@ -190,7 +190,7 @@ class BufferedIncrementalDecoder(IncrementalDecoder): buffer: bytes def __init__(self, errors: str = ...) -> None: ... @abstractmethod - def _buffer_decode(self, input: bytes, errors: str, final: bool) -> tuple[str, int]: ... + def _buffer_decode(self, input: ReadableBuffer, errors: str, final: bool) -> tuple[str, int]: ... def decode(self, input: bytes, final: bool = ...) -> str: ... # TODO: it is not possible to specify the requirement that all other From 7fa21dc1307fb19952682dac58b33e70ba045df8 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 2 Nov 2022 10:58:08 +0300 Subject: [PATCH 2/2] Fix CI --- stdlib/codecs.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index e01b9f308cc4..26c4a5801678 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -191,7 +191,7 @@ class BufferedIncrementalDecoder(IncrementalDecoder): def __init__(self, errors: str = ...) -> None: ... @abstractmethod def _buffer_decode(self, input: ReadableBuffer, errors: str, final: bool) -> tuple[str, int]: ... - def decode(self, input: bytes, final: bool = ...) -> str: ... + def decode(self, input: ReadableBuffer, final: bool = ...) -> str: ... # TODO: it is not possible to specify the requirement that all other # attributes and methods are passed-through from the stream.