8000 Change RawIOBase return types from None to MaybeNone by srittau · Pull Request #12686 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Change RawIOBase return types from None to MaybeNone #12686

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
Oct 2, 2024
Merged
Changes from 1 commit
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
Next Next commit
FileIO.read and write can return None in non-blocking mode
  • Loading branch information
srittau committed Sep 23, 2024
commit a6eb523c2a39d9bc38c5387c2f6ffe1ecc604dc6
8 changes: 5 additions & 3 deletions stdlib/io.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import abc
import builtins
import codecs
import sys
from _typeshed import FileDescriptorOrPath, ReadableBuffer, WriteableBuffer
from _typeshed import FileDescriptorOrPath, MaybeNone, ReadableBuffer, WriteableBuffer
from collections.abc import Callable, Iterable, Iterator
from os import _Opener
from types import TracebackType
Expand Down Expand Up @@ -102,8 +102,10 @@ class FileIO(RawIOBase, BinaryIO): # type: ignore[misc] # incompatible definit
) -> None: ...
@property
def closefd(self) -> bool: ...
def write(self, b: ReadableBuffer, /) -> int: ...
def read(self, size: int = -1, /) -> bytes: ...
# Can return None if the file is in non-blocking mode and no data is available.
def write(self, b: ReadableBuffer, /) -> int | MaybeNone: ...
# Can return None if the file is in non-blocking mode and no data is available.
def read(self, size: int = -1, /) -> bytes | MaybeNone: ...
def __enter__(self) -> Self: ...

class BytesIO(BufferedIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of methods in the base classes
Expand Down
Loading
0