diff --git a/stdlib/@tests/stubtest_allowlists/common.txt b/stdlib/@tests/stubtest_allowlists/common.txt index 41905256b..baf933be6 100644 --- a/stdlib/@tests/stubtest_allowlists/common.txt +++ b/stdlib/@tests/stubtest_allowlists/common.txt @@ -68,9 +68,6 @@ xml.sax.expatreader _thread.RLock _threading_local._localimpl.localargs _threading_local._localimpl.locallock -codecs.StreamReader.charbuffertype -codecs.StreamReader.seek -codecs.StreamWriter.seek ctypes.ARRAY ctypes.SetPointerType ctypes.c_voidp diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index a41df9752..b3c721f1e 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -3,7 +3,7 @@ from _codecs import * from _typeshed import ReadableBuffer from abc import abstractmethod from collections.abc import Callable, Generator, Iterable -from typing import Any, BinaryIO, Final, Literal, Protocol, TextIO +from typing import Any, BinaryIO, ClassVar, Final, Literal, Protocol, TextIO from typing_extensions import Self __all__ = [ @@ -202,6 +202,7 @@ class StreamWriter(Codec): def write(self, object: str) -> None: ... def writelines(self, list: Iterable[str]) -> None: ... def reset(self) -> None: ... + def seek(self, offset: int, whence: int = 0) -> None: ... def __enter__(self) -> Self: ... def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... def __getattr__(self, name: str, getattr: Callable[[Any, str], Any] = ...) -> Any: ... @@ -209,11 +210,14 @@ class StreamWriter(Codec): class StreamReader(Codec): stream: _ReadableStream errors: str + # This is set to str, but some subclasses set to bytes instead. + charbuffertype: ClassVar[type] = ... def __init__(self, stream: _ReadableStream, errors: str = "strict") -> None: ... def read(self, size: int = -1, chars: int = -1, firstline: bool = False) -> str: ... def readline(self, size: int | None = None, keepends: bool = True) -> str: ... def readlines(self, sizehint: int | None = None, keepends: bool = True) -> list[str]: ... def reset(self) -> None: ... + def seek(self, offset: int, whence: int = 0) -> None: ... def __enter__(self) -> Self: ... def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... def __iter__(self) -> Self: ...