mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-26707: Enable plistlib to read UID keys. (GH-12153)
Plistlib currently throws an exception when asked to decode a valid .plist file that was generated by Apple's NSKeyedArchiver. Specifically, this is caused by a byte 0x80 (signifying a UID) not being understood. This fixes the problem by enabling the binary plist reader and writer to read and write plistlib.UID objects.
This commit is contained in:
parent
e307e5cd06
commit
c981ad16b0
7 changed files with 169 additions and 5 deletions
|
@ -5,6 +5,7 @@ from Cocoa import NSPropertyListSerialization, NSPropertyListOpenStepFormat
|
|||
from Cocoa import NSPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0
|
||||
from Cocoa import CFUUIDCreateFromString, NSNull, NSUUID, CFPropertyListCreateData
|
||||
from Cocoa import NSURL
|
||||
from Cocoa import NSKeyedArchiver
|
||||
|
||||
import datetime
|
||||
from collections import OrderedDict
|
||||
|
@ -89,6 +90,8 @@ def main():
|
|||
else:
|
||||
print(" %s: binascii.a2b_base64(b'''\n %s'''),"%(fmt_name, _encode_base64(bytes(data)).decode('ascii')[:-1]))
|
||||
|
||||
keyed_archive_data = NSKeyedArchiver.archivedDataWithRootObject_("KeyArchive UID Test")
|
||||
print(" 'KEYED_ARCHIVE': binascii.a2b_base64(b'''\n %s''')," % (_encode_base64(bytes(keyed_archive_data)).decode('ascii')[:-1]))
|
||||
print("}")
|
||||
print()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue