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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
d72f78f8
Commit
d72f78f8
authored
May 22, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add recursive iterator for nested cypclasses
parent
b9d54780
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
Cython/Compiler/CypclassWrapper.py
Cython/Compiler/CypclassWrapper.py
+13
-5
No files found.
Cython/Compiler/CypclassWrapper.py
View file @
d72f78f8
...
@@ -24,17 +24,25 @@
...
@@ -24,17 +24,25 @@
#
#
def
cypclass_iter
(
scope
):
"""
Recursively iterate over nested cypclasses
"""
for
entry
in
scope
.
cypclass_entries
:
yield
entry
cypclass_scope
=
entry
.
type
.
scope
if
cypclass_scope
:
for
e
in
cypclass_iter
(
cypclass_scope
):
yield
e
def
generate_cypclass_typeobj_declarations
(
env
,
code
,
definition
):
def
generate_cypclass_typeobj_declarations
(
env
,
code
,
definition
):
"""
"""
Generate declarations of global pointers to the PyTypeObject for each cypclass
Generate declarations of global pointers to the PyTypeObject for each cypclass
"""
"""
for
entry
in
env
.
cypclass_entries
:
for
entry
in
cypclass_iter
(
env
)
:
if
definition
or
entry
.
defined_in_pxd
:
if
definition
or
entry
.
defined_in_pxd
:
code
.
putln
(
"static PyTypeObject *%s = 0;"
%
(
code
.
putln
(
"static PyTypeObject *%s = 0;"
%
(
entry
.
type
.
typeptr_cname
))
entry
.
type
.
typeptr_cname
))
cyp_scope
=
entry
.
type
.
scope
if
cyp_scope
:
# generate declarations for nested cycplasses
generate_cypclass_typeobj_declarations
(
cyp_scope
,
code
,
definition
)
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