Skip to content

Commit b4e49dd

Browse files
[asyncio] Allow any memoryview in write() and writelines() (#13519)
1 parent 6712f7f commit b4e49dd

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

stdlib/asyncio/sslproto.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
7676
def get_extra_info(self, name: str, default: Any | None = None) -> dict[str, Any]: ...
7777
@property
7878
def _protocol_paused(self) -> bool: ...
79-
def write(self, data: bytes | bytearray | memoryview) -> None: ...
79+
def write(self, data: bytes | bytearray | memoryview[Any]) -> None: ... # any memoryview format or shape
8080
def can_write_eof(self) -> Literal[False]: ...
8181
if sys.version_info >= (3, 11):
8282
def get_write_buffer_limits(self) -> tuple[int, int]: ...

stdlib/asyncio/transports.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ class WriteTransport(BaseTransport):
2424
def set_write_buffer_limits(self, high: int | None = None, low: int | None = None) -> None: ...
2525
def get_write_buffer_size(self) -> int: ...
2626
def get_write_buffer_limits(self) -> tuple[int, int]: ...
27-
def write(self, data: bytes | bytearray | memoryview) -> None: ...
28-
def writelines(self, list_of_data: Iterable[bytes | bytearray | memoryview]) -> None: ...
27+
def write(self, data: bytes | bytearray | memoryview[Any]) -> None: ... # any memoryview format or shape
28+
def writelines(
29+
self, list_of_data: Iterable[bytes | bytearray | memoryview[Any]]
30+
) -> None: ... # any memoryview format or shape
2931
def write_eof(self) -> None: ...
3032
def can_write_eof(self) -> bool: ...
3133
def abort(self) -> None: ...

tests/pytype_exclude_list.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
stdlib/builtins.pyi
66
stdlib/typing.pyi
77

8+
# can't subscript memoryview for some reason
9+
stdlib/asyncio/sslproto.pyi
10+
stdlib/asyncio/transports.pyi
11+
812
# errors about import statements
913
stubs/mysqlclient/MySQLdb/__init__.pyi
1014
stubs/mysqlclient/MySQLdb/connections.pyi

0 commit comments

Comments
 (0)