Skip to content

AttributeError on pointer dereferencing in loop target #1831

Closed
@nissarin

Description

@nissarin

I was trying to use a "cleaver trick" in my very first attempt to write a Cython module, the code which failed to compile boils down to something like this:

cdef int[1] arr
cdef int *ptr = arr

for ptr[0] in range(100):
    pass

While this form doesn't make sense in pure Python, in C it's an equivalent of using *ptr which is fine, so I was wondering if it would be possible to support it in Cython as well, at the very least it would be nice to have a more helpful error message.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions