Skip to content
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

numba: fix overload_call on numba >= 0.54.0 #414

Merged
merged 1 commit into from
Sep 2, 2021
Merged
Changes from all commits
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
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