'Calling a numba.guvectorize'ed function inside of another

I'm trying to call a vectorized function (numba.guvectorize) inside another guvectorize'd function:

import numpy as np
from numba import guvectorize

@guvectorize("(float64[:], float64[:])", "(n) -> (n)")
def pregain(device_gain, out):
    gain = np.cumsum(device_gain)[:-1]
    out[:] = np.concatenate((np.array([0.0]), gain))

@guvectorize("(float64[:], float64[:])", "(n) -> (n)")
def call_pregain(device_gain, out):
    pgain = pregain(device_gain)
    out[:] = pgain

call_pregain(np.array([12, -1.5, 8, -1, 2, -0.8, 15]))

But I get this error and numba falls back to object mode:

NumbaWarning: Compilation is falling back to object mode WITHOUT looplifting enabled because Function "call_pregain" failed type inference due to: Untyped global name 'pregain': Cannot determine Numba type of <class 'numba.np.ufunc.gufunc.GUFunc'>

File "mvce.py", line 13:
def call_pregain(device_gain, out):
    pgain = pregain(device_gain)
    ^


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source