Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue8729

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:The Mapping ABC's __eq__ method should return NotImplemented if the other type is not a Mapping
Type:behaviorStage:patch review
Components:Library (Lib)Versions:Python 3.1, Python 3.2, Python 2.7, Python 2.6
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: benjamin.peterson, pitrou, rhettinger, stutzbach
Priority:normalKeywords:patch

Created on2010-05-15 22:08 bystutzbach, last changed2022-04-11 14:57 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
mapping.patchstutzbach,2010-05-15 22:08Change Mapping.__eq__ to return NotImplemented if the other type isn't a Mapping
eq-test.patchstutzbach,2010-05-19 00:27Add test cases
mapping2.patchstutzbach,2010-05-21 18:57Revised patch, with fix and unit tests
Messages (10)
msg105833 -(view)Author: Daniel Stutzbach (stutzbach)(Python committer)Date: 2010-05-15 22:08
The Mapping ABC's __eq__ method should return NotImplemented if the other type is not a Mapping, to give the other type a chance at the comparison.  Right now it simply returns false.The comparison methods on the other ABCs in _abcoll.py already return NotImplemented if they don't recognize the other type.
msg105846 -(view)Author: Benjamin Peterson (benjamin.peterson)*(Python committer)Date: 2010-05-16 02:36
A test would be good.
msg105849 -(view)Author: Daniel Stutzbach (stutzbach)(Python committer)Date: 2010-05-16 05:06
Will do, sometime this week.
msg106000 -(view)Author: Raymond Hettinger (rhettinger)*(Python committer)Date: 2010-05-18 19:34
Backport to 2.6 and 3.1?
msg106001 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2010-05-18 19:36
Yes, I think this is a good candidate for backport. The ABCs are new and their APIs shouldn't contain any obvious bugs such as this.
msg106017 -(view)Author: Daniel Stutzbach (stutzbach)(Python committer)Date: 2010-05-19 00:27
Here's a patch that adds test cases.  It exercises all of the following special methods on Set and Mapping to ensure that they return NotImplemented if they don't recognize the other type.    lt, gt, le, ge, eq, ne, or, and, xor, subI made the patch against the py3k branch.I made the test-case patch separate to make it easier to see the before and after behavior of the actual fix.
msg106107 -(view)Author: Benjamin Peterson (benjamin.peterson)*(Python committer)Date: 2010-05-19 21:55
Will you post to Rietveld, please?
msg106131 -(view)Author: Daniel Stutzbach (stutzbach)(Python committer)Date: 2010-05-20 04:46
Done:http://codereview.appspot.com/1193044This is my first time using Rietveld.  Let me know if I've done anything wrong.
msg106257 -(view)Author: Daniel Stutzbach (stutzbach)(Python committer)Date: 2010-05-21 18:57
Here is a revised patch based on Benjamin's comments on Rietveld.
msg106264 -(view)Author: Benjamin Peterson (benjamin.peterson)*(Python committer)Date: 2010-05-21 20:52
Fixed inr81414. Thanks for the patch.
History
DateUserActionArgs
2022-04-11 14:57:01adminsetgithub: 52975
2010-05-21 20:52:37benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: +msg106264
2010-05-21 18:57:16stutzbachsetfiles: +mapping2.patch

messages: +msg106257
2010-05-20 04:46:58stutzbachsetmessages: +msg106131
2010-05-19 21:55:22benjamin.petersonsetmessages: +msg106107
2010-05-19 00:27:14stutzbachsetfiles: +eq-test.patch

messages: +msg106017
2010-05-18 19:36:31pitrousetnosy: +pitrou

messages: +msg106001
versions: + Python 2.6, Python 3.1
2010-05-18 19:34:19rhettingersetmessages: +msg106000
2010-05-17 21:20:57pitrousetnosy: +rhettinger
2010-05-16 05:06:58stutzbachsetmessages: +msg105849
2010-05-16 02:36:19benjamin.petersonsetnosy: +benjamin.peterson
messages: +msg105846
2010-05-15 22:08:11stutzbachcreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp