Skip to content

Commit f972bdf

Browse files
authored
io, codecs: improve bytes handling (#9059)
1 parent ab9988a commit f972bdf

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

stdlib/codecs.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import types
2-
from _typeshed import Self
2+
from _typeshed import ReadableBuffer, Self
33
from abc import abstractmethod
44
from collections.abc import Callable, Generator, Iterable
55
from typing import Any, BinaryIO, Protocol, TextIO
@@ -173,7 +173,7 @@ class IncrementalDecoder:
173173
errors: str
174174
def __init__(self, errors: str = ...) -> None: ...
175175
@abstractmethod
176-
def decode(self, input: bytes, final: bool = ...) -> str: ...
176+
def decode(self, input: ReadableBuffer, final: bool = ...) -> str: ...
177177
def reset(self) -> None: ...
178178
def getstate(self) -> tuple[bytes, int]: ...
179179
def setstate(self, state: tuple[bytes, int]) -> None: ...
@@ -190,8 +190,8 @@ class BufferedIncrementalDecoder(IncrementalDecoder):
190190
buffer: bytes
191191
def __init__(self, errors: str = ...) -> None: ...
192192
@abstractmethod
193-
def _buffer_decode(self, input: bytes, errors: str, final: bool) -> tuple[str, int]: ...
194-
def decode(self, input: bytes, final: bool = ...) -> str: ...
193+
def _buffer_decode(self, input: ReadableBuffer, errors: str, final: bool) -> tuple[str, int]: ...
194+
def decode(self, input: ReadableBuffer, final: bool = ...) -> str: ...
195195

196196
# TODO: it is not possible to specify the requirement that all other
197197
# attributes and methods are passed-through from the stream.

stdlib/io.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class StringIO(TextIOWrapper):
190190

191191
class IncrementalNewlineDecoder(codecs.IncrementalDecoder):
192192
def __init__(self, decoder: codecs.IncrementalDecoder | None, translate: bool, errors: str = ...) -> None: ...
193-
def decode(self, input: bytes | str, final: bool = ...) -> str: ...
193+
def decode(self, input: ReadableBuffer | str, final: bool = ...) -> str: ...
194194
@property
195195
def newlines(self) -> str | tuple[str, ...] | None: ...
196196
def setstate(self, __state: tuple[bytes, int]) -> None: ...

0 commit comments

Comments
 (0)