[Python] Python kernel dies when using numba overload

Discussão em 'Python' iniciado por Stack, Julho 5, 2025.

  1. Stack

    Stack Membro Participativo

    I am attempting to use an externally defined function inside of a numba jitted function, through use of numba's overload (docs here) but the Python kernel dies when I run it. Here is my minimal example to reproduce:

    from numpy.polynomial.legendre import leggauss as lg # My externally defined function
    import numba as nb
    from numba.extending import overload

    @overload(lg)
    def implementlg(n):
    if not isinstance(n, (int, nb.types.Integer, nb.int32)):
    raise nb.errors.TypingError("must be int")

    def impli(n):
    return lg(n)
    return impli

    @nb.jit(nopython=True)
    def tmp():
    return lg(15)

    tmp()


    I would guess my problem has something to do with the typing in my implementlg function, but without a stack trace I am at a loss.

    Continue reading...

Compartilhe esta Página