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
Xavier Thompson
cython
Commits
9df8c9da
Commit
9df8c9da
authored
Nov 03, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix destructor name computation in the face of namespace template args.
parent
af38a31a
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 @
9df8c9da
...
...
@@ -1132,7 +1132,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 @
9df8c9da
# 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