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
Add prefer_literal option to overload API #6058
Conversation
- Fix method resolution to consider prefer_literal
Failing test:
|
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.
Thanks for the patch, looks good, couple of minor things to look at.
@@ -55,7 +55,8 @@ def generic(self): | |||
_overload_default_jit_options = {'no_cpython_wrapper': True} | |||
|
|||
|
|||
def overload(func, jit_options={}, strict=True, inline='never'): | |||
def overload(func, jit_options={}, strict=True, inline='never', | |||
prefer_literal=False): |
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.
should this be documented? OR given the likelihood of it becoming a namedtuple or something for the next release, leave it?
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.
Actually, i should document it and leave a note that it might change.
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.
done in 89a3840
numba/core/types/functions.py
Outdated
unliteral_args = tuple([unliteral(a) for a in args]) | ||
unliteral_kws = {k: unliteral(v) for k, v in kws.items()} |
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.
BaseFunction::get_call_type
uses _unlit_non_poison
https://github.com/numba/numba/pull/6058/files#diff-758157deb494d50a6d6c93447b370a05R227-R234 want to reuse here?
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.
good pt
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.
done in efaa1a7
Co-authored-by: stuartarchibald <stuartarchibald@users.noreply.github.com>
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.
Thanks for the fixes.
Based on #6035
Add
prefer_literal
option to@overload
and@overload_method
.Fixes method dispatch in
BoundFunction
to follow #6035