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

Invalid C code for pxd-inline function that returns memory view #1415

Closed
robertwb opened this issue Aug 23, 2015 · 0 comments · Fixed by #4134
Closed

Invalid C code for pxd-inline function that returns memory view #1415

robertwb opened this issue Aug 23, 2015 · 0 comments · Fixed by #4134

Comments

@robertwb
Copy link
Contributor

# foo.pxd:

from cython cimport numeric
from libc.stdlib cimport malloc
cdef inline numeric[mview(size_t size, numeric* null):
    return <numeric[:size:1](::1])>malloc(size * sizeof(null))

# bar.pyx:

from foo cimport mview
def main():
    return mview(1, <double*>NULL)

C compiler error is:

bar.c: In function ‘__pyx_fuse_0__pyx_f_3foo_mview’:
bar.c:1571:13: error: incompatible types when assigning to type ‘__Pyx_memviewslice’ from type ‘int’
   __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dc_short(((PyObject *)__pyx_t_2));
             ^

Originally reported here:

http://thread.gmane.org/gmane.comp.python.cython.user/13946

Migrated from http://trac.cython.org/ticket/861

@robertwb robertwb added this to the wishlist milestone Aug 16, 2016
da-woods added a commit to da-woods/cython that referenced this issue Apr 24, 2021
Fixes cython#1415

The utilitycode was generated at too late a stage, after the
utilitycode from the pxd was merged into the pyx scope.
scoder pushed a commit that referenced this issue Apr 26, 2021
…les (GH-4134)

The utility code was generated at too late a stage, after the utility code from the pxd was merged into the pyx scope.

Fixes #1415
@scoder scoder modified the milestones: wishlist, 0.29.24 Apr 26, 2021
scoder pushed a commit that referenced this issue Apr 26, 2021
…les (GH-4134)

The utility code was generated at too late a stage, after the utility code from the pxd was merged into the pyx scope.

Fixes #1415
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants