Commit fa946e84 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix conversion of structs in namespaces.

parent 0acac5fb
......@@ -3257,8 +3257,10 @@ class CStructOrUnionType(CType):
self.scope = scope
self.typedef_flag = typedef_flag
self.is_struct = kind == 'struct'
self.to_py_function = "%s_to_py_%s" % (Naming.convert_func_prefix, self.cname)
self.from_py_function = "%s_from_py_%s" % (Naming.convert_func_prefix, self.cname)
self.to_py_function = "%s_to_py_%s" % (
Naming.convert_func_prefix, self.specialization_name())
self.from_py_function = "%s_from_py_%s" % (
Naming.convert_func_prefix, self.specialization_name())
self.exception_check = True
self._convert_to_py_code = None
self._convert_from_py_code = None
......
......@@ -3,6 +3,9 @@
cdef extern from "cpp_namespaces_helper.h" namespace "A":
ctypedef int A_t
cdef struct S:
double x
A_t k
A_t A_func(A_t first, A_t)
cdef void f(A_t)
......@@ -36,3 +39,11 @@ def test_typedef(A_t a):
3
"""
return a
def test_convert_struct(S s):
"""
>>> py_value = {'x': 3.5, 'k': 10}
>>> test_convert_struct(py_value) == py_value
True
"""
return s
......@@ -18,6 +18,11 @@ namespace A {
typedef int A_t;
struct S {
A_t k;
double x;
};
A_t A_func(A_t first, A_t second) {
return first + second;
}
......
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