numba: Providing many keyword arguments triggers assertion error with Python 3.10 due to unsupported bytecode

It seems that Python 3.10 produces a different bytecode instruction, CALL_FUNCTION_EX when using a large number of keyword arguments. From my testing it seems like this occurs once you reach 16 keyword arguments. I only see this behavior on Python 3.10 and not Python 3.9. Here is a reproducer:

import numba

@numba.njit
def my_func1(a=None, b=None, c=None, d=None, e=None, f=None, g=None, h=None, i=None, j=None, k=None, l=None, m=None, n=None, o=None, p=None):
    return my_func2(
        a=a,
        b=b,
        c=c,
        d=d,
        e=e,
        f=f,
        g=g,
        h=h,
        i=i,
        j=j,
        k=k,
        l=l,
        m=m,
        n=n,
        o=o,
        p=p
    )


@numba.njit
def my_func2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p):
    return


print(my_func1())

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (20 by maintainers)

Most upvoted comments

@njriasan, we are referring to rewriting the bytecode sequence as part of interpreter.py. An example of the rewrite can be find at:

https://github.com/numba/numba/blob/d9efc9ebce26c61eee2b3665144d0e321327131e/numba/core/interpreter.py#L82