Issue8729
Created on 2010-05-15 22:08 by stutzbach, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| mapping.patch | stutzbach, 2010-05-15 22:08 | Change Mapping.__eq__ to return NotImplemented if the other type isn't a Mapping | ||
| eq-test.patch | stutzbach, 2010-05-19 00:27 | Add test cases | ||
| mapping2.patch | stutzbach, 2010-05-21 18:57 | Revised patch, with fix and unit tests | ||
| Messages (10) | |||
|---|---|---|---|
| msg105833 - (view) | Author: Daniel Stutzbach (stutzbach) ![]() |
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) * ![]() |
Date: 2010-05-16 02:36 | |
A test would be good. |
|||
| msg105849 - (view) | Author: Daniel Stutzbach (stutzbach) ![]() |
Date: 2010-05-16 05:06 | |
Will do, sometime this week. |
|||
| msg106000 - (view) | Author: Raymond Hettinger (rhettinger) * ![]() |
Date: 2010-05-18 19:34 | |
Backport to 2.6 and 3.1? |
|||
| msg106001 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
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) ![]() |
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, sub
I 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) * ![]() |
Date: 2010-05-19 21:55 | |
Will you post to Rietveld, please? |
|||
| msg106131 - (view) | Author: Daniel Stutzbach (stutzbach) ![]() |
Date: 2010-05-20 04:46 | |
Done: http://codereview.appspot.com/1193044 This is my first time using Rietveld. Let me know if I've done anything wrong. |
|||
| msg106257 - (view) | Author: Daniel Stutzbach (stutzbach) ![]() |
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) * ![]() |
Date: 2010-05-21 20:52 | |
Fixed in r81414. Thanks for the patch. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:01 | admin | set | github: 52975 |
| 2010-05-21 20:52:37 | benjamin.peterson | set | status: open -> closed resolution: fixed messages: + msg106264 |
| 2010-05-21 18:57:16 | stutzbach | set | files:
+ mapping2.patch messages: + msg106257 |
| 2010-05-20 04:46:58 | stutzbach | set | messages: + msg106131 |
| 2010-05-19 21:55:22 | benjamin.peterson | set | messages: + msg106107 |
| 2010-05-19 00:27:14 | stutzbach | set | files:
+ eq-test.patch messages: + msg106017 |
| 2010-05-18 19:36:31 | pitrou | set | nosy:
+ pitrou messages:
+ msg106001 |
| 2010-05-18 19:34:19 | rhettinger | set | messages: + msg106000 |
| 2010-05-17 21:20:57 | pitrou | set | nosy:
+ rhettinger |
| 2010-05-16 05:06:58 | stutzbach | set | messages: + msg105849 |
| 2010-05-16 02:36:19 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages: + msg105846 |
| 2010-05-15 22:08:11 | stutzbach | create | |
