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
615af2d1
Commit
615af2d1
authored
Feb 04, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix assignable_from for cpp classes.
parent
6bb2e08f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+4
-0
tests/run/cpp_classes.pyx
tests/run/cpp_classes.pyx
+14
-0
No files found.
Cython/Compiler/PyrexTypes.py
View file @
615af2d1
...
...
@@ -1891,6 +1891,10 @@ class CppClassType(CType):
return
1
return
0
def
assignable_from_resolved_type
(
self
,
other_type
):
# TODO: handle operator=(...) here?
return
other_type
.
is_cpp_class
and
other_type
.
is_subclass
(
self
)
def
attributes_known
(
self
):
return
self
.
scope
is
not
None
...
...
tests/run/cpp_classes.pyx
View file @
615af2d1
...
...
@@ -48,3 +48,17 @@ def test_square_area(w):
finally
:
del
sqr
cdef
double
get_area
(
Rectangle
s
):
return
s
.
area
()
def
test_value_call
(
int
w
):
"""
>>> test_value_call(5)
(25.0, 25.0)
"""
cdef
Square
*
sqr
=
new
Square
(
w
)
cdef
Rectangle
*
rect
=
sqr
try
:
return
get_area
(
sqr
[
0
]),
get_area
(
rect
[
0
])
finally
:
del
sqr
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