cpython: dbdd5bc4df99 (original) (raw)
Mercurial > cpython
changeset 101202:dbdd5bc4df99
Issue #26711: Fixed the comparison of plistlib.Data with other types. [#26711]
Serhiy Storchaka storchaka@gmail.com | |
---|---|
date | Sun, 01 May 2016 13:36:42 +0300 |
parents | 5b2edc905db4(current diff)41afb83cffac(diff) |
children | 7188de6b50ab |
files | Lib/test/test_plistlib.py Misc/NEWS |
diffstat | 3 files changed, 7 insertions(+), 5 deletions(-)[+] [-] Lib/plistlib.py 4 Lib/test/test_plistlib.py 6 Misc/NEWS 2 |
line wrap: on
line diff
--- 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):[](#l1.7)
elif isinstance(other, bytes):[](#l1.8) return self.data == other[](#l1.9) else:[](#l1.10)
return id(self) == id(other)[](#l1.11)
return NotImplemented[](#l1.12)
def repr(self): return "%s(%s)" % (self.class.name, repr(self.data))
--- a/Lib/test/test_plistlib.py +++ b/Lib/test/test_plistlib.py @@ -514,15 +514,15 @@ class TestPlistlibDeprecated(unittest.Te cur = plistlib.loads(buf) self.assertEqual(cur, out_data)
self.assertNotEqual(cur, in_data)[](#l2.7)
self.assertEqual(cur, in_data)[](#l2.8)
cur = plistlib.loads(buf, use_builtin_types=False)
self.assertNotEqual(cur, out_data)[](#l2.11)
self.assertEqual(cur, out_data)[](#l2.12) self.assertEqual(cur, in_data)[](#l2.13)
with self.assertWarns(DeprecationWarning): cur = plistlib.readPlistFromBytes(buf)
self.assertNotEqual(cur, out_data)[](#l2.17)
self.assertEqual(cur, out_data)[](#l2.18) self.assertEqual(cur, in_data)[](#l2.19)
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -256,6 +256,8 @@ Core and Builtins Library ------- +- Issue #26711: Fixed the comparison of plistlib.Data with other types. +