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
546fceb7
Commit
546fceb7
authored
Nov 03, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bugs'
parents
c8640d65
9df8c9da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+5
-1
tests/run/cpp_classes.pyx
tests/run/cpp_classes.pyx
+21
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
546fceb7
...
...
@@ -1134,7 +1134,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
"if (p->__weakref__) PyObject_ClearWeakRefs(o);"
)
for
entry
in
cpp_class_attrs
:
destructor_name
=
entry
.
type
.
cname
.
split
(
"::"
)[
-
1
]
split_cname
=
entry
.
type
.
cname
.
split
(
'::'
)
destructor_name
=
split_cname
.
pop
()
# Make sure the namespace delimiter was not in a template arg.
while
destructor_name
.
count
(
'<'
)
!=
destructor_name
.
count
(
'>'
):
destructor_name
=
split_cname
.
pop
()
+
'::'
+
destructor_name
code
.
putln
(
"p->%s.%s::~%s();"
%
(
entry
.
cname
,
entry
.
type
.
declaration_code
(
""
),
destructor_name
))
...
...
tests/run/cpp_classes.pyx
View file @
546fceb7
# tag: cpp
from
libcpp.vector
cimport
vector
cdef
extern
from
"shapes.h"
namespace
"shapes"
:
cdef
cppclass
Shape
:
...
...
@@ -138,3 +140,22 @@ def test_class_member():
del
e1
,
e2
assert
destructor_count
-
start_destructor_count
==
2
,
\
destructor_count
-
start_destructor_count
cdef
class
TemplateClassMember
:
cdef
vector
[
int
]
x
cdef
vector
[
vector
[
Empty
]]
vec
def
test_template_class_member
():
"""
>>> test_template_class_member()
"""
cdef
vector
[
Empty
]
inner
inner
.
push_back
(
Empty
())
inner
.
push_back
(
Empty
())
o
=
TemplateClassMember
()
o
.
vec
.
push_back
(
inner
)
start_destructor_count
=
destructor_count
del
o
assert
destructor_count
-
start_destructor_count
==
2
,
\
destructor_count
-
start_destructor_count
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