Cython rejects float32 in fused dtype

Viewed 80

I am trying to write a Cython function that would be able to consume a fused dtype that includes float32. However it rejects the input unless specified explicitly. Why ?

For example:

cimport numpy as cnp

ctypedef fused floatdtype:
    cnp.npy_float32

@cy.boundscheck(False)
@cy.wraparound(False)
cpdef void test(floatdtype smth):
    print(smth)

And then in Python the below raises "TypeError: No matching signature found" error:

import numpy as np

smth= np.float32(19700101.0)
test(smth)

However this works just fine:

cimport numpy as cnp

@cy.boundscheck(False)
@cy.wraparound(False)
cpdef void test( cnp.npy_float32 smth):
    print(smth)
0 Answers
Related