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

Checking contiguity of memoryviews within a cython not working #3053

Open
JuanGGO opened this issue Jul 24, 2019 · 0 comments

Comments

@JuanGGO
Copy link

commented Jul 24, 2019

Hi, using cython 0.28.5 I encounter the following situation.

Say I have the following two routines inside the file test.pyx

cpdef test1(int[:, ::1] array):
   test2(array[4:8, 5:9])

cdef test2(int[:, ::1] array):
   pass array to a method in c++ that expects array to be C-contiguous

when I pass a numpy array directly from python to test1 that is not contiguous then an error is raised. However when I pass an non-contiguous memoryview to a method then no error is raised and the execution continues. I don't know if this is an actual bug or a "feature".
I couldn't find any guidelines in the documentation and my guess is that this is an actual bug because not raising an error in the function test2 might lead to very nasty bugs when passing the buffer to other languages that expect the buffer to be continuous. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.