-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Mapping ABC's __eq__ method should return NotImplemented if the other type is not a Mapping #52975
Comments
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. |
A test would be good. |
Will do, sometime this week. |
Backport to 2.6 and 3.1? |
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. |
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.
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. |
Will you post to Rietveld, please? |
Done: http://codereview.appspot.com/1193044 This is my first time using Rietveld. Let me know if I've done anything wrong. |
Here is a revised patch based on Benjamin's comments on Rietveld. |
Fixed in r81414. Thanks for the patch. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: