Skip to content

Commit 0d4f435

Browse files
cstylesronaldoussoren
authored andcommitted
Clarify that plistlib's load and dump functions take a binary file object (GH-9825)
The documentation says that the fp parameter to plistlib.load "should be a readable and binary file object" but the docstring only mentions that it should be readable. Similarly, plistlib.dump's docstring only mentions "writable". This commit clarifies that fp should also be binary. https://docs.python.org/3/library/plistlib.html#plistlib.load https://docs.python.org/3/library/plistlib.html#plistlib.dump
1 parent 52c8c09 commit 0d4f435

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/plistlib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ def _is_fmt_binary(header):
971971

972972

973973
def load(fp, *, fmt=None, use_builtin_types=True, dict_type=dict):
974-
"""Read a .plist file. 'fp' should be (readable) file object.
974+
"""Read a .plist file. 'fp' should be a readable and binary file object.
975975
Return the unpacked root object (which usually is a dictionary).
976976
"""
977977
if fmt is None:
@@ -1002,8 +1002,8 @@ def loads(value, *, fmt=None, use_builtin_types=True, dict_type=dict):
10021002

10031003

10041004
def dump(value, fp, *, fmt=FMT_XML, sort_keys=True, skipkeys=False):
1005-
"""Write 'value' to a .plist file. 'fp' should be a (writable)
1006-
file object.
1005+
"""Write 'value' to a .plist file. 'fp' should be a writable,
1006+
binary file object.
10071007
"""
10081008
if fmt not in _FORMATS:
10091009
raise ValueError("Unsupported format: %r"%(fmt,))

0 commit comments

Comments
 (0)