From 49ef964f8a260e8318ee8d143269e2c2532f7517 Mon Sep 17 00:00:00 2001 From: deanm0000 <37878412+deanm0000@users.noreply.github.com> Date: Sun, 28 Apr 2024 08:35:13 -0400 Subject: [PATCH] fix(python): Change recognition of numba ufunc (#15916) --- py-polars/polars/expr/expr.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/py-polars/polars/expr/expr.py b/py-polars/polars/expr/expr.py index 3e0dc65d83ae..70a1f75d3808 100644 --- a/py-polars/polars/expr/expr.py +++ b/py-polars/polars/expr/expr.py @@ -293,7 +293,8 @@ def __array_ufunc__( if method != "__call__": msg = f"Only call is implemented not {method}" raise NotImplementedError(msg) - is_custom_ufunc = ufunc.__class__ != np.ufunc + # Numpy/Scipy ufuncs have signature None but numba signatures always exists. + is_custom_ufunc = getattr(ufunc, "signature") is not None # noqa: B009 num_expr = sum(isinstance(inp, Expr) for inp in inputs) exprs = [ (inp, Expr, i) if isinstance(inp, Expr) else (inp, None, i)