-
Notifications
You must be signed in to change notification settings - Fork 286
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
Rich compasions of Int32-based ints and subclasses of int return NotImplemented #1554
Comments
Possibly. Will look into it. |
Hmm, the example given above works for me (after adding |
Ahh, sorry about that. Should have |
Thanks. First bad commit is 3ed501b (it's mine indeed). |
The cause for this regression is that in beta subclasses of Looking at the code, If this is just a matter of 100% CPython compatibility, then I assume it only applies to |
I'm not sure if there are real world scenarios, but the one I ran into was basically this (from class EvilClass(int):
def __lt__(self, o):
# do something
return NotImplemented
EvilClass(1) < 2 which ends up throwing a Looks like any reversible operator "implemented" like this would end up throwing so just adding the rich comparison overloads would not solve the issue. Anyway, I don't think it's super critical - was just wondering if there was a quick fix. |
The fix would be to modify |
Well, I guess it would save me having to patch |
Calling a rich comparison directly on an instance of an Int32-based
int
returnsNotImplemented
for subclasses of int. In CPython, the comparison succeeds. However, it works properly forBigInteger
. for For example:Seems to have broken somewhere between the alpha and the beta releases. @BCSharp could this be related to your work on #52?
The text was updated successfully, but these errors were encountered: