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
Kirill Smelkov
cython
Commits
9141e7a5
Commit
9141e7a5
authored
Mar 21, 2021
by
Vadim Pushtaev
Committed by
GitHub
Mar 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow using nested C++ types of typedefs (GH-4039)
Closes
https://github.com/cython/cython/issues/2233
parent
ff1f703b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+4
-1
tests/run/cpp_nested_classes.pyx
tests/run/cpp_nested_classes.pyx
+18
-0
No files found.
Cython/Compiler/Nodes.py
View file @
9141e7a5
...
...
@@ -1044,7 +1044,10 @@ class CSimpleBaseTypeNode(CBaseTypeNode):
scope
=
env
for
item
in
self
.
module_path
:
entry
=
scope
.
lookup
(
item
)
if
entry
is
not
None
and
entry
.
is_cpp_class
:
if
entry
is
not
None
and
(
entry
.
is_cpp_class
or
entry
.
is_type
and
entry
.
type
.
is_cpp_class
):
scope
=
entry
.
type
.
scope
else
:
scope
=
None
...
...
tests/run/cpp_nested_classes.pyx
View file @
9141e7a5
...
...
@@ -26,6 +26,10 @@ cdef extern from "cpp_nested_classes_support.h":
pass
ctypedef
A
AliasA1
ctypedef
AliasA1
AliasA2
def
test_nested_classes
():
"""
>>> test_nested_classes()
...
...
@@ -47,6 +51,20 @@ def test_nested_typedef(py_x):
cdef
A
.
my_int
x
=
py_x
assert
A
.
negate
(
x
)
==
-
py_x
def
test_typedef_for_nested
(
py_x
):
"""
>>> test_typedef_for_nested(5)
"""
cdef
AliasA1
.
my_int
x
=
py_x
assert
A
.
negate
(
x
)
==
-
py_x
def
test_typedef_for_nested_deep
(
py_x
):
"""
>>> test_typedef_for_nested_deep(5)
"""
cdef
AliasA2
.
my_int
x
=
py_x
assert
A
.
negate
(
x
)
==
-
py_x
def
test_typed_nested_typedef
(
x
):
"""
>>> test_typed_nested_typedef(4)
...
...
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