Repository navigation
Check operand types in bool or, and, xor to be PyInt - #5461
Merged
Merged
Conversation
Flipping of parameter order to satisfy __r<op>__ dunder is done via macros
PyNumber methods are expected to type check both arguments. Dispatch is not done by inverting parameter order for __r<op>__ (example __ror__) when calls are handled via PyNumberMethods
youknowone
requested changes
Dec 28, 2024
youknowone
left a comment
Member
There was a problem hiding this comment.
Good catch! Thank you.
Code changes looks perfect. Please check the comment part.
| /// | ||
| /// Order operations are tried until either a valid result or error: | ||
| /// b.rop(b,a)[*], a.op(a,b), b.rop(b,a) | ||
| /// b.rop(a,b)[*], a.op(a,b), b.rop(a,b) |
Member
There was a problem hiding this comment.
rop is a reversed version of op. So (b,a) is intended.
Contributor
Author
There was a problem hiding this comment.
Done. Had changed the comment looking at https://github.com/python/cpython/blob/main/Objects/abstract.c#L920
Member
There was a problem hiding this comment.
Oh, thank you! we'd better to follow it later.
youknowone
reviewed
Dec 28, 2024
youknowone
left a comment
Member
There was a problem hiding this comment.
oh, please also remove get_py_int from bool.rs which is not used anymore
Contributor
Author
|
Thanks for the review! Made both changes, PTAL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PyNumber methods are expected to type check both arguments.
Dispatch is not done by inverting parameter order for r (example ror) when calls are handled via PyNumberMethods
Other changes:
Fixes: #5460