Commit 546fceb7 authored by Robert Bradshaw's avatar Robert Bradshaw

Merge branch 'bugs'

parents c8640d65 9df8c9da
......@@ -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))
......
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment