8000 Tighten TextIOWrapper buffer types by srittau · Pull Request #10266 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Tighten TextIOWrapper buffer types #10266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Tighten TextIOWrapper buffer types
This matches the documentation, which says:

> A buffered text stream providing higher-level access to a BufferedIOBase
> buffered binary stream.

Cf #10229
  • Loading branch information
srittau committed Jun 6, 2023
commit 2d0a393ae0cbecd2431ef4eec3cd91bc32f5dde8
5 changes: 3 additions & 2 deletions stdlib/io.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ class TextIOBase(IOBase):
class TextIOWrapper(TextIOBase, TextIO): # type: ignore[misc] # incompatible definitions of write in the base classes
def __init__(
self,
buffer: IO[bytes],
buffer: BufferedIOBase,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
line_buffering: bool = ...,
write_through: bool = ...,
) -> None: ...
@property
def buffer(self) -> BinaryIO: ...
def buffer(self) -> BufferedIOBase: ... # type: ignore[override]
@property
def closed(self) -> bool: ...
@property
Expand All @@ -178,6 +178,7 @@ class TextIOWrapper(TextIOBase, TextIO): # type: ignore[misc] # incompatible d
def writelines(self, __lines: Iterable[str]) -> None: ... # type: ignore[override]
def readline(self, __size: int = -1) -> str: ... # type: ignore[override]
def readlines(self, __hint: int = -1) -> list[str]: ... # type: ignore[override]
def detach(self) -> BufferedIOBase: ... # type: ignore[override]
def seek(self, __cookie: int, __whence: int = 0) -> int: ... # stubtest needs this

class StringIO(TextIOWrapper):
Expand Down
0