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
9928cff1
Commit
9928cff1
authored
Feb 23, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not cast structures, memoryview slices or complex numbers
parent
169bf8a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+3
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+10
-0
No files found.
Cython/Compiler/Nodes.py
View file @
9928cff1
...
...
@@ -3306,7 +3306,9 @@ class DefNodeWrapper(FuncDefNode):
if
self
.
signature
.
has_dummy_arg
:
args
.
append
(
Naming
.
self_cname
)
for
arg
in
self
.
args
:
if
arg
.
hdr_type
and
not
(
arg
.
type
.
is_memoryviewslice
or
arg
.
type
.
is_struct
):
if
arg
.
hdr_type
and
not
(
arg
.
type
.
is_memoryviewslice
or
arg
.
type
.
is_struct
or
arg
.
type
.
is_complex
):
args
.
append
(
arg
.
type
.
cast_code
(
arg
.
entry
.
cname
))
else
:
args
.
append
(
arg
.
entry
.
cname
)
...
...
Cython/Compiler/PyrexTypes.py
View file @
9928cff1
...
...
@@ -732,6 +732,8 @@ class MemoryViewSliceType(PyrexType):
if
dtype
is
not
self
.
dtype
:
return
MemoryViewSliceType
(
dtype
,
self
.
axes
)
def
cast_code
(
self
,
expr_code
):
return
expr_code
class
BufferType
(
BaseType
):
...
...
@@ -1822,6 +1824,9 @@ class CComplexType(CNumericType):
def
py_type_name
(
self
):
return
"complex"
def
cast_code
(
self
,
expr_code
):
return
expr_code
complex_ops
=
{
(
1
,
'-'
):
'neg'
,
(
1
,
'zero'
):
'is_zero'
,
...
...
@@ -2860,6 +2865,11 @@ class CStructOrUnionType(CType):
for
x
in
self
.
scope
.
var_entries
]
return
max
(
child_depths
)
+
1
def
cast_code
(
self
,
expr_code
):
if
self
.
is_struct
:
return
expr_code
return
super
(
CStructOrUnionType
,
self
).
cast_code
(
expr_code
)
class
CppClassType
(
CType
):
# name string
# cname string
...
...
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