I'm struggling with the situation when I need a code like this to work:
from custom_lib import custom_type, custom_dtype
import numpy as np
a = custom_type(1)
arr = np.array([a,a],dtype=custom_dtype)
arr+a // doesn't work ( No cast function available. )
arr+np.array(a,dtype=custom_dtype) // works and just broadcasts properly
And my wrapped type is double-like type but has a special behavior on math operations so I need a full CPython wrapping of this type and numpy compatibility ( that is why boost.python doesn't work for me ).
Any numpy c-api masters here? Any help appreciated.