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

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

Open
dalleyg opened this Issue Sep 8, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@dalleyg
Contributor

dalleyg commented Sep 8, 2017

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

@scoder scoder added the C++ label Sep 13, 2017

@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder Sep 13, 2017

Contributor

Seems to be allowed in C++, but when I remove the error catcher in ExprNodes.py, it doesn't do what you would think. It simply reassigns the variable. I'll ask @robertwb what the intention of this error was.

Contributor

scoder commented Sep 13, 2017

Seems to be allowed in C++, but when I remove the error catcher in ExprNodes.py, it doesn't do what you would think. It simply reassigns the variable. I'll ask @robertwb what the intention of this error was.

@shaggyrogers

This comment has been minimized.

Show comment
Hide comment
@shaggyrogers

shaggyrogers Nov 27, 2017

This issue is still present as of version 0.27.3. Cheers for the workaround @dalleyg.

shaggyrogers commented Nov 27, 2017

This issue is still present as of version 0.27.3. Cheers for the workaround @dalleyg.

@ibarrond

This comment has been minimized.

Show comment
Hide comment
@ibarrond

ibarrond Jul 26, 2018

Still present as of 0.28.4

ibarrond commented Jul 26, 2018

Still present as of 0.28.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment