[Python-checkins] cpython (merge 3.5 -> default): Issue #26711: Fixed the comparison of plistlib.Data with other types.
serhiy.storchaka
python-checkins at python.org
Sun May 1 06:37:07 EDT 2016
https://hg.python.org/cpython/rev/dbdd5bc4df99
changeset: 101202:dbdd5bc4df99
parent: 101200:5b2edc905db4
parent: 101201:41afb83cffac
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sun May 01 13:36:42 2016 +0300
summary:
Issue #26711: Fixed the comparison of plistlib.Data with other types.
files:
Lib/plistlib.py | 4 ++--
Lib/test/test_plistlib.py | 6 +++---
Misc/NEWS | 2 ++
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/Lib/plistlib.py b/Lib/plistlib.py
--- a/Lib/plistlib.py
+++ b/Lib/plistlib.py
@@ -225,10 +225,10 @@
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
--- a/Lib/test/test_plistlib.py
+++ b/Lib/test/test_plistlib.py
@@ -514,15 +514,15 @@
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)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -256,6 +256,8 @@
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
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list