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
da2a3963
Commit
da2a3963
authored
Apr 11, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix BufferType's assignable_from & some tests
parent
29d68530
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
11 deletions
+18
-11
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+12
-5
tests/run/numpy_test.pyx
tests/run/numpy_test.pyx
+5
-5
No files found.
Cython/Compiler/Nodes.py
View file @
da2a3963
...
...
@@ -2578,7 +2578,7 @@ def __pyx_fused_cpdef(signatures, args, kwargs):
candidates = []
for sig in signatures:
match_found =
filter(None, dest_sig)
match_found =
[x for x in dest_sig if x]
for src_type, dst_type in zip(sig.strip('()').split(', '), dest_sig):
if dst_type is not None and match_found:
match_found = src_type == dst_type
...
...
Cython/Compiler/PyrexTypes.py
View file @
da2a3963
...
...
@@ -791,14 +791,21 @@ class BufferType(BaseType):
cast_str
)
def
assignable_from
(
self
,
other_type
):
return
self
.
same_as
(
other_type
)
or
other_type
.
is_pyobject
if
other_type
.
is_buffer
:
return
(
self
.
same_as
(
other_type
,
compare_base
=
False
)
and
self
.
base
.
assignable_from
(
other_type
.
base
))
def
same_as
(
self
,
other_type
):
return
(
other_type
.
is_buffer
and
self
.
dtype
.
same_as
(
other_type
.
dtype
)
and
return
self
.
base
.
assignable_from
(
other_type
)
def
same_as
(
self
,
other_type
,
compare_base
=
True
):
if
not
other_type
.
is_buffer
:
return
other_type
.
same_as
(
self
.
base
)
return
(
self
.
dtype
.
same_as
(
other_type
.
dtype
)
and
self
.
ndim
==
other_type
.
ndim
and
self
.
mode
==
other_type
.
mode
and
self
.
cast
==
other_type
.
cast
)
or
self
.
base
.
same_as
(
other_type
)
self
.
cast
==
other_type
.
cast
and
(
not
compare_base
or
self
.
base
.
same_as
(
other_type
.
base
)))
class
PyObjectType
(
PyrexType
):
...
...
tests/run/numpy_test.pyx
View file @
da2a3963
...
...
@@ -528,7 +528,7 @@ cdef fused fused_external:
def
test_fused_external
(
np
.
ndarray
[
fused_external
,
ndim
=
1
]
a
):
"""
>>> import cython
>>>
print
sorted(test_fused_external.__signatures__)
>>> sorted(test_fused_external.__signatures__)
['float32_t', 'float64_t', 'int32_t', 'int64_t']
>>> test_fused_external["float64_t"](double_array)
...
...
@@ -539,10 +539,7 @@ def test_fused_external(np.ndarray[fused_external, ndim=1] a):
>>> test_fused_external(np.arange(100)) # fix in next release
Traceback (most recent call last):
File "/Users/mark/source/py/osx/lib/python2.7/doctest.py", line 1248, in __run
compileflags, 1) in test.globs
File "<doctest numpy_test.__test__.test_fused_external (line 525)[5]>", line 1, in <module>
File "numpy_test.pyx", line 525, in numpy_test.__pyx_fused_cpdef (numpy_test.cpp:10264)
...
TypeError: No matching signature found
"""
print
a
.
dtype
...
...
@@ -554,6 +551,7 @@ cdef fused fused_buffers:
def
test_fused_buffers
(
fused_buffers
arg
):
"""
>>> sorted(test_fused_buffers.__signatures__)
['int64_t[::1]', 'ndarray[int32_t,ndim=1]']
"""
cpdef
_fused_cpdef_buffers
(
np
.
ndarray
[
fused_external
]
a
):
...
...
@@ -562,6 +560,8 @@ cpdef _fused_cpdef_buffers(np.ndarray[fused_external] a):
def
test_fused_cpdef_buffers
():
"""
>>> test_fused_cpdef_buffers()
int32
int32
"""
_fused_cpdef_buffers
[
np
.
int32_t
](
int32_array
)
...
...
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