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
29b22283
Commit
29b22283
authored
Aug 08, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix fused signature delimiter and ndim dispatch
parent
977c15c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
Cython/Compiler/FusedNode.py
Cython/Compiler/FusedNode.py
+4
-3
tests/run/numpy_test.pyx
tests/run/numpy_test.pyx
+17
-0
No files found.
Cython/Compiler/FusedNode.py
View file @
29b22283
...
...
@@ -211,7 +211,7 @@ class FusedCFuncDefNode(StatListNode):
for
fused_type
in
fused_types
]
node
.
specialized_signature_string
=
'
,
'
.
join
(
type_strings
)
node
.
specialized_signature_string
=
'
|
'
.
join
(
type_strings
)
node
.
entry
.
pymethdef_cname
=
PyrexTypes
.
get_fused_cname
(
cname
,
node
.
entry
.
pymethdef_cname
)
...
...
@@ -322,7 +322,8 @@ class FusedCFuncDefNode(StatListNode):
for
dtype_category
,
codewriter
in
dtypes
:
if
dtype_category
:
cond
=
'{{itemsize_match}}'
cond
=
'{{itemsize_match}} and arg.ndim == %d'
%
(
specialized_type
.
ndim
,)
if
dtype
.
is_int
:
cond
+=
' and {{signed_match}}'
...
...
@@ -587,7 +588,7 @@ class FusedCFuncDefNode(StatListNode):
candidates = []
for sig in signatures:
match_found = False
for src_type, dst_type in zip(sig.strip('()').split('
,
'), dest_sig):
for src_type, dst_type in zip(sig.strip('()').split('
|
'), dest_sig):
if dst_type is not None:
if src_type == dst_type:
match_found = True
...
...
tests/run/numpy_test.pyx
View file @
29b22283
...
...
@@ -849,4 +849,21 @@ def test_dispatch_memoryview_object():
cdef
int
[:]
m3
=
<
object
>
m
test_fused_memslice
(
m3
)
cdef
fused
ndim_t
:
double
[:]
double
[:,
:]
double
[:,
:,
:]
@
testcase
def
test_dispatch_ndim
(
ndim_t
array
):
"""
>>> test_dispatch_ndim(np.empty(5, dtype=np.double))
double[:] 1
>>> test_dispatch_ndim(np.empty((5, 5), dtype=np.double))
double[:, :] 2
>>> test_dispatch_ndim(np.empty((5, 5, 5), dtype=np.double))
double[:, :, :] 3
"""
print
cython
.
typeof
(
array
),
np
.
asarray
(
array
).
ndim
include
"numpy_common.pxi"
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