Skip to content

Commit

Permalink
Merge pull request #414 from eric-wieser/fix-numba-0.54.0
Browse files Browse the repository at this point in the history
numba: fix overload_call on numba >= 0.54.0
  • Loading branch information
eric-wieser authored Sep 2, 2021
2 parents 9e8fcf2 + 13ac052 commit e63f856
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions clifford/numba/_overload_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,13 @@ class _OverloadCallTemplate(_OverloadAttributeTemplate):
"""
is_method = True

@classmethod
def do_class_init(cls):
"""
Register generic method implementation.
"""
# https://github.com/numba/numba/pull/7061 broke this hack, so we have to
# special case it before and after

@classmethod
def _init_once_impl(cls, lower_builtin):
# this line is changed for __call__
@numba.extending.lower_builtin(cls.key, cls.key, types.VarArg(types.Any))
@lower_builtin(cls.key, cls.key, types.VarArg(types.Any))
def method_impl(context, builder, sig, args):
typ = sig.args[0]
typing_context = context.typing_context
Expand All @@ -54,6 +53,15 @@ def method_impl(context, builder, sig, args):
context.add_linking_libs(getattr(call, 'libs', ()))
return call(builder, args)

@classmethod
def do_class_init(cls):
# numba < 0.54.0rc1
cls._init_once_impl(numba.extending.lower_builtin)

def _init_once(self):
# numba >= 0.54.0rc1
self._init_once_impl(self._get_target_registry().lower)

def _resolve(self, typ, attr):
if self._attr != attr:
return None
Expand Down

0 comments on commit e63f856

Please sign in to comment.