Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
numba/core/types/functions.py
  • Loading branch information
Nicholas J Riasanovsky
Nicholas J Riasanovsky committed Jul 9, 2021
commit 7e86ad921d118be1cd21ce851aedf4d3e42907f0
18 changes: 12 additions & 6 deletions numba/core/types/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,10 @@ def copy(self, this):

@property
def key(self):
return self.typing_key, self.this
# FIXME: With target-overload, the MethodTemplate can change depending
# on the target.
unique_impl = getattr(self.template, "_overload_func", None)
return self.typing_key, self.this, unique_impl

def get_impl_key(self, sig):
"""
Expand All @@ -405,6 +408,7 @@ def get_call_type(self, context, args, kws):
literal_e = None
nonliteral_e = None
out = None

choice = [True, False] if template.prefer_literal else [False, True]
for uselit in choice:
if uselit:
Expand Down Expand Up @@ -441,10 +445,7 @@ def get_call_type(self, context, args, kws):
raise exc
nonliteral_e = exc
else:
# If out returns None don't break as we may need to use
# a literal.
if out is not None:
break
break

if out is None and (nonliteral_e is not None or literal_e is not None):
header = "- Resolution failure for {} arguments:\n{}\n"
Expand Down Expand Up @@ -567,7 +568,12 @@ def dispatcher(self):
A strong reference to the underlying numba.dispatcher.Dispatcher
instance.
"""
return self._get_object()
disp = self._get_object()
# TODO: improve interface to avoid the dynamic check here
if hasattr(disp, "_get_dispatcher_for_current_target"):
return disp._get_dispatcher_for_current_target()
else:
return disp

def get_overload(self, sig):
"""
Expand Down