Skip to content
  • Sponsor python/typeshed

  • Notifications You must be signed in to change notification settings
  • Fork 1.8k

Allow memoryview[bytes] in write() and writelines() #13519

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 18 commits into from
Mar 20, 2025
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
2 changes: 1 addition & 1 deletion stdlib/asyncio/sslproto.pyi
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
def get_extra_info(self, name: str, default: Any | None = None) -> dict[str, Any]: ...
@property
def _protocol_paused(self) -> bool: ...
def write(self, data: bytes | bytearray | memoryview) -> None: ...
def write(self, data: bytes | bytearray | memoryview[Any]) -> None: ... # any memoryview format or shape
def can_write_eof(self) -> Literal[False]: ...
if sys.version_info >= (3, 11):
def get_write_buffer_limits(self) -> tuple[int, int]: ...
6 changes: 4 additions & 2 deletions stdlib/asyncio/transports.pyi
Original file line number Diff line number Diff line change
@@ -24,8 +24,10 @@ class WriteTransport(BaseTransport):
def set_write_buffer_limits(self, high: int | None = None, low: int | None = None) -> None: ...
def get_write_buffer_size(self) -> int: ...
def get_write_buffer_limits(self) -> tuple[int, int]: ...
def write(self, data: bytes | bytearray | memoryview) -> None: ...
def writelines(self, list_of_data: Iterable[bytes | bytearray | memoryview]) -> None: ...
def write(self, data: bytes | bytearray | memoryview[Any]) -> None: ... # any memoryview format or shape
def writelines(
self, list_of_data: Iterable[bytes | bytearray | memoryview[Any]]
) -> None: ... # any memoryview format or shape
def write_eof(self) -> None: ...
def can_write_eof(self) -> bool: ...
def abort(self) -> None: ...
4 changes: 4 additions & 0 deletions tests/pytype_exclude_list.txt
Original file line number Diff line number Diff line change
@@ -5,6 +5,10 @@
stdlib/builtins.pyi
stdlib/typing.pyi

# can't subscript memoryview for some reason
stdlib/asyncio/sslproto.pyi
stdlib/asyncio/transports.pyi

# errors about import statements
stubs/mysqlclient/MySQLdb/__init__.pyi
stubs/mysqlclient/MySQLdb/connections.pyi