Commit 47d1d7f4 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #26711: Fixed the comparison of plistlib.Data with other types.

parents b608196b dd1bcdf6
...@@ -225,10 +225,10 @@ class Data: ...@@ -225,10 +225,10 @@ class Data:
def __eq__(self, other): def __eq__(self, other):
if isinstance(other, self.__class__): if isinstance(other, self.__class__):
return self.data == other.data return self.data == other.data
elif isinstance(other, str): elif isinstance(other, bytes):
return self.data == other return self.data == other
else: else:
return id(self) == id(other) return NotImplemented
def __repr__(self): def __repr__(self):
return "%s(%s)" % (self.__class__.__name__, repr(self.data)) return "%s(%s)" % (self.__class__.__name__, repr(self.data))
......
...@@ -514,15 +514,15 @@ class TestPlistlibDeprecated(unittest.TestCase): ...@@ -514,15 +514,15 @@ class TestPlistlibDeprecated(unittest.TestCase):
cur = plistlib.loads(buf) cur = plistlib.loads(buf)
self.assertEqual(cur, out_data) self.assertEqual(cur, out_data)
self.assertNotEqual(cur, in_data) self.assertEqual(cur, in_data)
cur = plistlib.loads(buf, use_builtin_types=False) cur = plistlib.loads(buf, use_builtin_types=False)
self.assertNotEqual(cur, out_data) self.assertEqual(cur, out_data)
self.assertEqual(cur, in_data) self.assertEqual(cur, in_data)
with self.assertWarns(DeprecationWarning): with self.assertWarns(DeprecationWarning):
cur = plistlib.readPlistFromBytes(buf) cur = plistlib.readPlistFromBytes(buf)
self.assertNotEqual(cur, out_data) self.assertEqual(cur, out_data)
self.assertEqual(cur, in_data) self.assertEqual(cur, in_data)
......
...@@ -256,6 +256,8 @@ Core and Builtins ...@@ -256,6 +256,8 @@ Core and Builtins
Library Library
------- -------
- Issue #26711: Fixed the comparison of plistlib.Data with other types.
- Issue #24114: Fix an uninitialized variable in `ctypes.util`. - Issue #24114: Fix an uninitialized variable in `ctypes.util`.
The bug only occurs on SunOS when the ctypes implementation searches The bug only occurs on SunOS when the ctypes implementation searches
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment