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
ae6700cc
Commit
ae6700cc
authored
May 21, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate declarations of PyTypeObject pointer for cypclasses
parent
587d280d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
0 deletions
+13
-0
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+11
-0
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+1
-0
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+1
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
ae6700cc
...
...
@@ -615,6 +615,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
modulecode
.
putln
(
""
)
modulecode
.
putln
(
"/* Module declarations from '%s' */"
%
module
.
qualified_name
)
self
.
generate_c_class_declarations
(
module
,
modulecode
,
defined_here
)
self
.
generate_cypclass_typeobj_declarations
(
module
,
modulecode
,
defined_here
)
self
.
generate_cvariable_declarations
(
module
,
modulecode
,
defined_here
)
self
.
generate_cfunction_declarations
(
module
,
modulecode
,
defined_here
)
...
...
@@ -1807,6 +1808,16 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
"static PyTypeObject *%s = 0;"
%
(
entry
.
type
.
typeptr_cname
))
def
generate_cypclass_typeobj_declarations
(
self
,
env
,
code
,
definition
):
for
entry
in
env
.
cypclass_entries
:
if
definition
or
entry
.
defined_in_pxd
:
code
.
putln
(
"static PyTypeObject *%s = 0;"
%
(
entry
.
type
.
typeptr_cname
))
cyp_scope
=
entry
.
type
.
scope
if
cyp_scope
:
# generate declarations for nested cycplasses
self
.
generate_cypclass_typeobj_declarations
(
cyp_scope
,
code
,
definition
)
def
generate_cvariable_declarations
(
self
,
env
,
code
,
definition
):
if
env
.
is_cython_builtin
:
return
...
...
Cython/Compiler/PyrexTypes.py
View file @
ae6700cc
...
...
@@ -3967,6 +3967,7 @@ class CypClassType(CppClassType):
self
.
activable
=
activable
self
.
_mro
=
None
self
.
_left_path_to_base
=
{}
self
.
typeptr_cname
=
None
# set externally
# Return the MRO for this cypclass
# Compute all the mro needed when a previous computation is not available
...
...
Cython/Compiler/Symtab.py
View file @
ae6700cc
...
...
@@ -707,6 +707,7 @@ class Scope(object):
if
cypclass
:
type
=
PyrexTypes
.
CypClassType
(
name
,
scope
,
cname
,
base_classes
,
templates
=
templates
,
lock_mode
=
lock_mode
,
activable
=
activable
)
type
.
typeptr_cname
=
self
.
mangle
(
Naming
.
typeptr_prefix
,
cname
)
else
:
type
=
PyrexTypes
.
CppClassType
(
name
,
scope
,
cname
,
base_classes
,
templates
=
templates
)
...
...
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