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
Gwenaël Samain
cython
Commits
359d1c70
Commit
359d1c70
authored
May 23, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Declare complex utility codes when used in fused types
parent
aba4d55b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
Cython/Compiler/FusedNode.py
Cython/Compiler/FusedNode.py
+11
-0
tests/run/fused_types.pyx
tests/run/fused_types.pyx
+10
-0
No files found.
Cython/Compiler/FusedNode.py
View file @
359d1c70
...
...
@@ -32,6 +32,8 @@ class FusedCFuncDefNode(StatListNode):
specializations
code_object CodeObjectNode shared by all specializations and the
fused function
fused_compound_types All fused (compound) types (e.g. floating[:])
"""
__signatures__
=
None
...
...
@@ -76,6 +78,8 @@ class FusedCFuncDefNode(StatListNode):
[
arg
.
type
for
arg
in
self
.
node
.
args
if
arg
.
type
.
is_fused
])
permutations
=
PyrexTypes
.
get_all_specialized_permutations
(
fused_compound_types
)
self
.
fused_compound_types
=
fused_compound_types
if
self
.
node
.
entry
in
env
.
pyfunc_entries
:
env
.
pyfunc_entries
.
remove
(
self
.
node
.
entry
)
...
...
@@ -121,6 +125,7 @@ class FusedCFuncDefNode(StatListNode):
env
.
pyfunc_entries
.
remove
(
orig_py_func
.
entry
)
fused_types
=
self
.
node
.
type
.
get_fused_types
()
self
.
fused_compound_types
=
fused_types
for
cname
,
fused_to_specific
in
permutations
:
copied_node
=
copy
.
deepcopy
(
self
.
node
)
...
...
@@ -656,6 +661,12 @@ class FusedCFuncDefNode(StatListNode):
Analyse the expressions. Take care to only evaluate default arguments
once and clone the result for all specializations
"""
for
fused_compound_type
in
self
.
fused_compound_types
:
for
fused_type
in
fused_compound_type
.
get_fused_types
():
for
specialization_type
in
fused_type
.
types
:
if
specialization_type
.
is_complex
:
specialization_type
.
create_declaration_utility_code
(
env
)
if
self
.
py_func
:
self
.
__signatures__
.
analyse_expressions
(
env
)
self
.
py_func
.
analyse_expressions
(
env
)
...
...
tests/run/fused_types.pyx
View file @
359d1c70
...
...
@@ -272,3 +272,13 @@ def test_fused_memslice_dtype(cython.floating[:] array):
cdef
cython
.
floating
[:]
otherarray
=
array
[
0
:
100
:
1
]
print
cython
.
typeof
(
array
),
cython
.
typeof
(
otherarray
),
\
array
[
5
],
otherarray
[
6
]
def
test_cython_numeric
(
cython
.
numeric
arg
):
"""
Test to see whether complex numbers have their utility code declared
properly.
>>> test_cython_numeric(10.0 + 1j)
double complex (10+1j)
"""
print
cython
.
typeof
(
arg
),
arg
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