Skip to content
4 changes: 4 additions & 0 deletions stdlib/@tests/stubtest_allowlists/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol i
inspect.Parameter.__init__
inspect.Signature.__init__

# Abstract methods that don't exist at runtime
_io._IOBase.read
_io._IOBase.write

logging.LogRecord.__setattr__ # doesn't exist, but makes things easy if we pretend it does

# Iterable classes that don't define __iter__ at runtime (usually iterable via __getitem__)
Expand Down
14 changes: 9 additions & 5 deletions stdlib/_io.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import builtins
import codecs
import sys
from _typeshed import FileDescriptorOrPath, MaybeNone, ReadableBuffer, WriteableBuffer
from collections.abc import Callable, Iterable, Iterator
from collections.abc import Iterable, Iterator
from io import BufferedIOBase, RawIOBase, TextIOBase, UnsupportedOperation as UnsupportedOperation
from os import _Opener
from types import TracebackType
Expand Down Expand Up @@ -36,14 +36,16 @@ if sys.version_info >= (3, 12):
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def readable(self) -> bool: ...
read: Callable[..., Any]
# Abstract method that doesn't exist at runtime, the exact return type depends on the sub-class
def read(self, size: int = ..., /) -> Any: ...
def readlines(self, hint: int = -1, /) -> list[bytes]: ...
def seek(self, offset: int, whence: int = 0, /) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: int | None = None, /) -> int: ...
def writable(self) -> bool: ...
write: Callable[..., Any]
# Abstract method that doesn't exist at runtime, the exact arguments and return type depend on the sub-class
def write(self, s: Any, /) -> Any: ...
def writelines(self, lines: Iterable[ReadableBuffer], /) -> None: ...
def readline(self, size: int | None = -1, /) -> bytes: ...
def __del__(self) -> None: ...
Expand All @@ -64,14 +66,16 @@ else:
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def readable(self) -> bool: ...
read: Callable[..., Any]
# Abstract method that doesn't exist at runtime, the exact arguments and return type depend on the sub-class
def read(self) -> Any: ...
def readlines(self, hint: int = -1, /) -> list[bytes]: ...
def seek(self, offset: int, whence: int = 0, /) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: int | None = None, /) -> int: ...
def writable(self) -> bool: ...
write: Callable[..., Any]
# Abstract method that doesn't exist at runtime, the exact arguments and return type depend on the sub-class
def write(self, s: Any, /) -> Any: ...
def writelines(self, lines: Iterable[ReadableBuffer], /) -> None: ...
def readline(self, size: int | None = -1, /) -> bytes: ...
def __del__(self) -> None: ...
Expand Down
Loading