Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add casting capability to cffi_support.ffi.from_buffer in nopython mode #3902

Open
dimitar-petrov opened this issue Mar 26, 2019 · 0 comments

Comments

@dimitar-petrov
Copy link

dimitar-petrov commented Mar 26, 2019

Feature request

Currently casting a numpy array with dtype=np.complex128 and passing it to cffi function is not possible in nopython mode.

from numba import cffi_support, njit
import numpy as np

def f(a):
    cdata = cffi_support.ffi.from_buffer('double []', a)
    
a = np.ascontiguousarray([], dtype=np.complex128)
f(a)
njit(f)(a)

It would be great if different cdata could be passed. Since now it supports only the default cdata="char[]"

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of BoundFunction(ffi.from_buffer for ffi) with parameters (Literal[str](double []), array(complex128, 1d, C))
 * parameterized
[1] During: resolving callee type: BoundFunction(ffi.from_buffer for ffi)
[2] During: typing of call at <ipython-input-27-3dc53d0b7bf1> (4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants