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
eef2bc65
Commit
eef2bc65
authored
Oct 10, 2015
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix buffer access bug when indices are mutated during analysis.
parent
899f01f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-5
tests/buffers/bufaccess.pyx
tests/buffers/bufaccess.pyx
+11
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
eef2bc65
...
...
@@ -3421,11 +3421,8 @@ class IndexNode(_IndexingBaseNode):
elif
base_type
.
is_buffer
and
len
(
indices
)
==
base_type
.
ndim
:
# Buffer indexing
is_buffer_access
=
True
for
index
in
indices
:
index
=
index
.
analyse_types
(
env
)
if
not
index
.
type
.
is_int
:
is_buffer_access
=
False
if
is_buffer_access
:
indices
=
[
index
.
analyse_types
(
env
)
for
index
in
indices
]
if
all
(
index
.
type
.
is_int
for
index
in
indices
):
replacement_node
=
BufferIndexNode
(
self
.
pos
,
indices
=
indices
,
base
=
self
.
base
)
# On cloning, indices is cloned. Otherwise, unpack index into indices.
assert
not
isinstance
(
self
.
index
,
CloneNode
)
...
...
tests/buffers/bufaccess.pyx
View file @
eef2bc65
...
...
@@ -1184,3 +1184,14 @@ def test_inplace_assignment():
buf
[
0
]
=
get_int
()
print
buf
[
0
]
@
testcase
def
test_nested_assignment
():
"""
>>> test_nested_assignment()
100
"""
cdef
object
[
int
]
inner
=
IntMockBuffer
(
None
,
[
1
,
2
,
3
])
cdef
object
[
int
]
outer
=
IntMockBuffer
(
None
,
[
1
,
2
,
3
])
outer
[
inner
[
0
]]
=
100
return
outer
[
inner
[
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