Skip to content

Fix stab for TextIOBase.detach() and add stab for TextIOWrapper.buffer #4036

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

Merged
merged 2 commits into from
May 19, 2020
Merged
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
8 changes: 5 additions & 3 deletions stdlib/3/io.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class TextIOBase(IOBase):
newlines: Union[str, Tuple[str, ...], None]
def __iter__(self) -> Iterator[str]: ... # type: ignore
def __next__(self) -> str: ... # type: ignore
def detach(self) -> IOBase: ...
def detach(self) -> BinaryIO: ...
def write(self, s: str) -> int: ...
def writelines(self, __lines: List[str]) -> None: ... # type: ignore
def readline(self, size: int = ...) -> str: ... # type: ignore
Expand All @@ -164,13 +164,15 @@ class TextIOWrapper(TextIO):
# -> None: ...
def __init__(
self,
buffer: IO[bytes],
buffer: BinaryIO,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe CI fails due to this change. Honestly, I would just leave this instance as IO[bytes] for now. In the future it might make sense to make TextIOWrapper generic over the buffer, but I haven't looked at it in depth.

encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
line_buffering: bool = ...,
write_through: bool = ...
) -> None: ...
@property
def buffer(self) -> BinaryIO: ...
if sys.version_info >= (3, 7):
def reconfigure(
self,
Expand Down Expand Up @@ -205,7 +207,7 @@ class TextIOWrapper(TextIO):
def __iter__(self) -> Iterator[str]: ...
def __next__(self) -> str: ...
def __enter__(self) -> TextIO: ...
def detach(self) -> IOBase: ...
def detach(self) -> BinaryIO: ...
def write(self, __text: str) -> int: ...
def readline(self, __size: int = ...) -> str: ...
def read(self, __size: Optional[int] = ...) -> str: ...
Expand Down