Skip to content

Commit 34e147f

Browse files
authored
plistlib: improve bytes handling (#9048)
1 parent 7f476e1 commit 34e147f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

stdlib/plistlib.pyi

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from _typeshed import Self
2+
from _typeshed import ReadableBuffer, Self
33
from collections.abc import Mapping, MutableMapping
44
from datetime import datetime
55
from enum import Enum
@@ -48,7 +48,9 @@ FMT_BINARY = PlistFormat.FMT_BINARY
4848

4949
if sys.version_info >= (3, 9):
5050
def load(fp: IO[bytes], *, fmt: PlistFormat | None = ..., dict_type: type[MutableMapping[str, Any]] = ...) -> Any: ...
51-
def loads(value: bytes, *, fmt: PlistFormat | None = ..., dict_type: type[MutableMapping[str, Any]] = ...) -> Any: ...
51+
def loads(
52+
value: ReadableBuffer, *, fmt: PlistFormat | None = ..., dict_type: type[MutableMapping[str, Any]] = ...
53+
) -> Any: ...
5254

5355
else:
5456
def load(
@@ -59,23 +61,23 @@ else:
5961
dict_type: type[MutableMapping[str, Any]] = ...,
6062
) -> Any: ...
6163
def loads(
62-
value: bytes,
64+
value: ReadableBuffer,
6365
*,
6466
fmt: PlistFormat | None = ...,
6567
use_builtin_types: bool = ...,
6668
dict_type: type[MutableMapping[str, Any]] = ...,
6769
) -> Any: ...
6870

6971
def dump(
70-
value: Mapping[str, Any] | list[Any] | tuple[Any, ...] | str | bool | float | bytes | datetime,
72+
value: Mapping[str, Any] | list[Any] | tuple[Any, ...] | str | bool | float | bytes | bytearray | datetime,
7173
fp: IO[bytes],
7274
*,
7375
fmt: PlistFormat = ...,
7476
sort_keys: bool = ...,
7577
skipkeys: bool = ...,
7678
) -> None: ...
7779
def dumps(
78-
value: Mapping[str, Any] | list[Any] | tuple[Any, ...] | str | bool | float | bytes | datetime,
80+
value: Mapping[str, Any] | list[Any] | tuple[Any, ...] | str | bool | float | bytes | bytearray | datetime,
7981
*,
8082
fmt: PlistFormat = ...,
8183
skipkeys: bool = ...,
@@ -85,7 +87,7 @@ def dumps(
8587
if sys.version_info < (3, 9):
8688
def readPlist(pathOrFile: str | IO[bytes]) -> Any: ...
8789
def writePlist(value: Mapping[str, Any], pathOrFile: str | IO[bytes]) -> None: ...
88-
def readPlistFromBytes(data: bytes) -> Any: ...
90+
def readPlistFromBytes(data: ReadableBuffer) -> Any: ...
8991
def writePlistToBytes(value: Mapping[str, Any]) -> bytes: ...
9092

9193
if sys.version_info < (3, 9):

0 commit comments

Comments
 (0)