[Python-modules-team] Bug#973082: confirmed

Stefano Rivera stefanor at debian.org
Sun Jan 31 19:52:17 GMT 2021


Control: forwarded -1 https://bitbucket.org/wooster/biplist/issues/12/python-39-compatibility
Control: tag -1 + patch

Hi Hans-Christoph (2021.01.03_13:54:51_-0700)
> In Python 3.9, the plistlib was changed to no longer have the internal data
> structure plistlib.Data, which biplist relied on.

From what I can see one just uses bytes instead of plistlib.Data, so
this should work on Python 3.9:

diff --git a/biplist/__init__.py b/biplist/__init__.py
index f9d5836..4a40602 100644
--- a/biplist/__init__.py
+++ b/biplist/__init__.py
@@ -147,14 +147,7 @@ def readPlist(pathOrFile):
     return result
 
 def wrapDataObject(o, for_binary=False):
-    if isinstance(o, Data) and not for_binary:
-        v = sys.version_info
-        if not (v[0] >= 3 and v[1] >= 4):
-            o = plistlib.Data(o)
-    elif isinstance(o, (bytes, plistlib.Data)) and for_binary:
-        if hasattr(o, 'data'):
-            o = Data(o.data)
-    elif isinstance(o, tuple):
+    if isinstance(o, tuple):
         o = wrapDataObject(list(o), for_binary)
         o = tuple(o)
     elif isinstance(o, list):

It's not the correct backwards-compatible fix, though. So not proposing this upstream.

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  +1 415 683 3272



More information about the Python-modules-team mailing list