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
Boxiang Sun
cython
Commits
7551bd22
Commit
7551bd22
authored
Aug 20, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix compiler crash on in-place buffer C division
parent
52af0421
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-1
tests/memoryview/memoryview_inplace_division.pyx
tests/memoryview/memoryview_inplace_division.pyx
+28
-0
No files found.
Cython/Compiler/Nodes.py
View file @
7551bd22
...
...
@@ -4533,7 +4533,8 @@ class InPlaceAssignmentNode(AssignmentNode):
if
isinstance
(
self
.
lhs
,
ExprNodes
.
IndexNode
)
and
self
.
lhs
.
is_buffer_access
:
if
self
.
lhs
.
type
.
is_pyobject
:
error
(
self
.
pos
,
"In-place operators not allowed on object buffers in this release."
)
if
c_op
in
(
'/'
,
'%'
)
and
self
.
lhs
.
type
.
is_int
and
not
code
.
directives
[
'cdivision'
]:
if
(
c_op
in
(
'/'
,
'%'
)
and
self
.
lhs
.
type
.
is_int
and
not
code
.
globalstate
.
directives
[
'cdivision'
]):
error
(
self
.
pos
,
"In-place non-c divide operators not allowed on int buffers."
)
self
.
lhs
.
generate_buffer_setitem_code
(
self
.
rhs
,
code
,
c_op
)
else
:
...
...
tests/memoryview/memoryview_inplace_division.pyx
0 → 100644
View file @
7551bd22
# mode: run
# tag: memoryview, cdivision
cimport
cython
from
cpython.array
cimport
array
# make Cython aware of the array type
def
div_memoryview
(
int
[:]
A
):
"""
>>> from array import array
>>> x = array('i', [6])
>>> div_memoryview(x)
>>> x[0]
3
"""
with
cython
.
cdivision
(
True
):
A
[
0
]
/=
2
def
div_buffer
(
object
[
int
,
ndim
=
1
]
A
):
"""
>>> from array import array
>>> x = array('i', [6])
>>> div_buffer(x)
>>> x[0]
3
"""
with
cython
.
cdivision
(
True
):
A
[
0
]
/=
2
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