-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Reimplement the divmod() C integer optimisation using dynamic code generation #6801
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
Conversation
|
||
if function in needed_coercions and env: | ||
arg_i, coerce_to_type = needed_coercions[function] | ||
args[arg_i] = args[arg_i].coerce_to(coerce_to_type, env) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this was previously done twice. The (single) caller already applied the coercions at need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had only a quick look and seems OK to me...
One comment though. PR uses/rewrites a ranking algorithm for choosing correct type I have on comment and one question:
|
There is at least a docstring in the |
I think it's mostly tested indirectly. Type inference is an important part of this, C++ signature overloading and builtin types overloading is another. Direct unit testing would definitely be an improvement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No obvious issues from me - a couple of small suggestions
…in double, as Python divmod().
… second operand is a float. Only optimise safe cases.
Thank you! Confirmed that this fixes the failures we were seeing in pandas. Looking forward to seeing this in the nightly wheel |
See #6717
Closes #6786