[issue26711] Fix comparison of plistlib.Data

2016-05-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: For simplicity I left "==" and fixed only obvious bug. -- assignee: -> serhiy.storchaka resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue26711] Fix comparison of plistlib.Data

2016-05-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset 41afb83cffac by Serhiy Storchaka in branch '3.5': Issue #26711: Fixed the comparison of plistlib.Data with other types. https://hg.python.org/cpython/rev/41afb83cffac New changeset dbdd5bc4df99 by Serhiy Storchaka in branch 'default': Issue #26711:

[issue26711] Fix comparison of plistlib.Data

2016-05-01 Thread Ronald Oussoren
Ronald Oussoren added the comment: Serhiy, I slightly prefer the second patch, but either one would be fine. The reason I asked about explicitly calling __eq__ is that this is an uncommon pattern (at least for me). Ronald -- ___ Python tracker

[issue26711] Fix comparison of plistlib.Data

2016-04-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Ronald, my second patch uses "==" instead of __eq__. Is it good to you? -- ___ Python tracker ___

[issue26711] Fix comparison of plistlib.Data

2016-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : Added file: http://bugs.python.org/file42398/plistlib_data_eq_2.patch ___ Python tracker ___ ___ Python-bugs-lis

[issue26711] Fix comparison of plistlib.Data

2016-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: >>> import plistlib >>> class MyData(bytes): ... def __eq__(self, other): ... if isinstance(other, plistlib.Data): ... return super().__eq__(other.value) ... return False ... >>> plistlib.Data(b'x') == MyData(b'x') True If use

[issue26711] Fix comparison of plistlib.Data

2016-04-08 Thread Ronald Oussoren
Ronald Oussoren added the comment: I don't understand the explicit use of __eq__ in the bytes case. Why is that needed? -- ___ Python tracker ___ ___

[issue26711] Fix comparison of plistlib.Data

2016-04-07 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch fixes several bugs in plistlib.Data.__eq__(). * isinstance(other, str) was used instead of isinstance(other, bytes). Data always wraps bytes and should be comparable with bytes. str was correct type in Python 2. * id(self) == id(other) is a