summaryrefslogtreecommitdiffstats
path: root/Mac/Tools/plistlib_generate_testdata.py
diff options
context:
space:
mode:
authorJon Janzen <jjjonjanzen@gmail.com>2019-05-15 20:14:38 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2019-05-15 20:14:38 (GMT)
commitc981ad16b0f9740bd3381c96b4227a1faa1a88d9 (patch)
tree11ae5ac3f709d5ddd54a27334207441f7debe025 /Mac/Tools/plistlib_generate_testdata.py
parente307e5cd06f60e11e4e4f126fae412b9ec66a005 (diff)
downloadcpython-c981ad16b0f9740bd3381c96b4227a1faa1a88d9.zip
cpython-c981ad16b0f9740bd3381c96b4227a1faa1a88d9.tar.gz
cpython-c981ad16b0f9740bd3381c96b4227a1faa1a88d9.tar.bz2
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.
Diffstat (limited to 'Mac/Tools/plistlib_generate_testdata.py')
-rwxr-xr-xMac/Tools/plistlib_generate_testdata.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Mac/Tools/plistlib_generate_testdata.py b/Mac/Tools/plistlib_generate_testdata.py
index 057b617..3349c60 100755
--- a/Mac/Tools/plistlib_generate_testdata.py
+++ b/Mac/Tools/plistlib_generate_testdata.py
@@ -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()