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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
b9cecd60
Commit
b9cecd60
authored
Jul 29, 2020
by
da-woods
Committed by
GitHub
Jul 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed reference types being passed to getitemint (GH-3755)
parent
12a2ad5a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-0
tests/run/lvalue_refs.pyx
tests/run/lvalue_refs.pyx
+12
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
b9cecd60
...
...
@@ -3739,6 +3739,8 @@ class IndexNode(_IndexingBaseNode):
if
not
base_type
.
is_cfunction
:
self
.
index
=
self
.
index
.
analyse_types
(
env
)
self
.
original_index_type
=
self
.
index
.
type
if
self
.
original_index_type
.
is_reference
:
self
.
original_index_type
=
self
.
original_index_type
.
ref_base_type
if
base_type
.
is_unicode_char
:
# we infer Py_UNICODE/Py_UCS4 for unicode strings in some
...
...
tests/run/lvalue_refs.pyx
View file @
b9cecd60
...
...
@@ -28,3 +28,15 @@ def test_lvalue_ref_assignment():
assert
bar
[
0
]
==
&
baz
[
0
][
0
]
assert
bar
[
0
][
0
]
==
bongle
# 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
def
test_ref_used_for_indexing
():
"""
>>> test_ref_used_for_indexing()
'looked up correctly'
"""
cdef
vector
[
int
]
idx
=
[
1
,
2
,
3
]
d
=
{
1
:
"looked up correctly"
,
2
:
"oops"
}
return
d
[
idx
[
0
]]
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