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
fa946e84
Commit
fa946e84
authored
Feb 02, 2016
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix conversion of structs in namespaces.
parent
0acac5fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+4
-2
tests/run/cpp_namespaces.pyx
tests/run/cpp_namespaces.pyx
+11
-0
tests/run/cpp_namespaces_helper.h
tests/run/cpp_namespaces_helper.h
+5
-0
No files found.
Cython/Compiler/PyrexTypes.py
View file @
fa946e84
...
...
@@ -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
...
...
tests/run/cpp_namespaces.pyx
View file @
fa946e84
...
...
@@ -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
tests/run/cpp_namespaces_helper.h
View file @
fa946e84
...
...
@@ -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
;
}
...
...
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