Skip to content

"Assignment to reference" bug reintroduced in Cython 0.26.x #1863

@dalleyg

Description

@dalleyg

A bug was introduced in Cython 0.18 that caused code like this to fail

cdef void foo(double& out):
    out = 123

with an "Assignment to reference" error. See https://groups.google.com/d/msg/cython-users/j58Sp3QMrD4/y9vJy9YBi_kJ The bug was fixed and code like that worked through Cython 0.25.2. I just tried Cython 0.26.1 and the bug has reappeared.

As before, the workaround is to upgrade the reference parameter to a full pointer then dereference it:

cdef void foo(double& out):
    (&out)[0] = 123

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions