diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-01 13:36:42 +0300 |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-01 13:36:42 +0300 |
| commit | 47d1d7f48a841dc5539638c3941445d8507e6beb (patch) | |
| tree | d8bea256ab2b21cc660aa31f5df74433f9f1a3ef | |
| parent | b608196b20483ef69fab0383e61d3e53aed04ece (diff) | |
| parent | dd1bcdf6187ff18fb1536a6190926b0f03336186 (diff) | |
| download | cpython-git-47d1d7f48a841dc5539638c3941445d8507e6beb.tar.gz | |
Issue #26711: Fixed the comparison of plistlib.Data with other types.
| -rw-r--r-- | Lib/plistlib.py | 4 | ||||
| -rw-r--r-- | Lib/test/test_plistlib.py | 6 | ||||
| -rw-r--r-- | Misc/NEWS | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/Lib/plistlib.py b/Lib/plistlib.py index a39151fb0b..b66639ca9e 100644 --- a/Lib/plistlib.py +++ b/Lib/plistlib.py @@ -225,10 +225,10 @@ class Data: def __eq__(self, other): if isinstance(other, self.__class__): return self.data == other.data - elif isinstance(other, str): + elif isinstance(other, bytes): return self.data == other else: - return id(self) == id(other) + return NotImplemented def __repr__(self): return "%s(%s)" % (self.__class__.__name__, repr(self.data)) diff --git a/Lib/test/test_plistlib.py b/Lib/test/test_plistlib.py index 12d92fa769..662ed904b0 100644 --- a/Lib/test/test_plistlib.py +++ b/Lib/test/test_plistlib.py @@ -514,15 +514,15 @@ class TestPlistlibDeprecated(unittest.TestCase): cur = plistlib.loads(buf) self.assertEqual(cur, out_data) - self.assertNotEqual(cur, in_data) + self.assertEqual(cur, in_data) cur = plistlib.loads(buf, use_builtin_types=False) - self.assertNotEqual(cur, out_data) + self.assertEqual(cur, out_data) self.assertEqual(cur, in_data) with self.assertWarns(DeprecationWarning): cur = plistlib.readPlistFromBytes(buf) - self.assertNotEqual(cur, out_data) + self.assertEqual(cur, out_data) self.assertEqual(cur, in_data) @@ -256,6 +256,8 @@ Core and Builtins Library ------- +- Issue #26711: Fixed the comparison of plistlib.Data with other types. + - Issue #24114: Fix an uninitialized variable in `ctypes.util`. The bug only occurs on SunOS when the ctypes implementation searches |
