Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
ba37c35c
Commit
ba37c35c
authored
Dec 18, 2021
by
da-woods
Committed by
GitHub
Dec 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ban on assignment to reference (GH-3987)
Fixes
https://github.com/cython/cython/issues/1863
parent
ea43f8ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+0
-2
tests/run/lvalue_refs.pyx
tests/run/lvalue_refs.pyx
+12
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
ba37c35c
...
...
@@ -2136,8 +2136,6 @@ class NameNode(AtomicExprNode):
if
self
.
type
.
is_const
:
error
(
self
.
pos
,
"Assignment to const '%s'"
%
self
.
name
)
if
self
.
type
.
is_reference
:
error
(
self
.
pos
,
"Assignment to reference '%s'"
%
self
.
name
)
if
not
self
.
is_lvalue
():
error
(
self
.
pos
,
"Assignment to non-lvalue '%s'"
%
self
.
name
)
self
.
type
=
PyrexTypes
.
error_type
...
...
tests/run/lvalue_refs.pyx
View file @
ba37c35c
...
...
@@ -29,6 +29,18 @@ def test_lvalue_ref_assignment():
assert
bar
[
0
]
==
&
baz
[
0
][
0
]
assert
bar
[
0
][
0
]
==
bongle
cdef
void
assign_to_basic_reference
(
int
&
ref
):
ref
=
123
def
test_assign_to_basic_ref
():
"""
>>> test_assign_to_basic_ref()
123
"""
cdef
int
x
=
0
assign_to_basic_reference
(
x
)
print
x
# not *strictly* lvalue refs but this file seems the closest applicable place for it.
# GH 3754 - std::vector operator[] returns a reference, and this causes problems if
# the reference is passed into Cython __Pyx_GetItemInt
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment