Skip to content
Prev Previous commit
Next Next commit
remove StringLiteral and Boolean
  • Loading branch information
guilhermeleobas committed Feb 18, 2022
commit 6b7fa648977b42cdd8d694daf26c279aa4c3752d
3 changes: 1 addition & 2 deletions numba/np/arrayobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -1410,8 +1410,7 @@ def numpy_broadcast_arrays(*args):
for idx, arg in enumerate(args):
if isinstance(arg, types.ArrayCompatible):
m = max(m, arg.ndim)
elif isinstance(arg, (types.Number, types.StringLiteral,
types.Boolean)):
elif isinstance(arg, types.Number):
m = max(m, 1)
Comment on lines +1425 to +1429

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unfortunately doesn't work:

from numba import njit
import numpy as np

@njit
def foo(tupl):
    return np.broadcast_arrays(tupl, tupl)

print(foo((1,2)))

I think the issue is that this loop is not handling tuple types? Probably needs something like:

        elif isinstance(arg, types.BaseTuple):
            m = max(m, arg.count)

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


# m = max([arr.ndim for arr in args])
Expand Down