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
4e3c2d75
Commit
4e3c2d75
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
708faf67
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+11
-0
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+2
-0
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+1
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
4e3c2d75
...
...
@@ -680,6 +680,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
modulecode
.
putln
(
""
)
modulecode
.
putln
(
"/* Module declarations from %s */"
%
module
.
qualified_name
.
as_c_string_literal
())
self
.
generate_c_class_declarations
(
module
,
modulecode
,
defined_here
,
globalstate
)
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
)
...
...
@@ -1906,6 +1907,16 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
"Py_VISIT(traverse_module_state->%s);"
%
(
entry
.
type
.
typeobj_cname
))
code
.
putln
(
"#endif"
)
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
:
...
...
Cython/Compiler/PyrexTypes.py
View file @
4e3c2d75
...
...
@@ -4111,6 +4111,7 @@ class CypClassType(CppClassType):
self
.
lock_mode
=
lock_mode
if
lock_mode
else
"autolock"
self
.
activable
=
activable
self
.
_mro
=
None
self
.
typeptr_cname
=
None
# set externally
# Return the MRO for this cypclass
# Compute all the mro needed when a previous computation is not available
...
...
@@ -4132,6 +4133,7 @@ class CypClassType(CppClassType):
self
.
_mro
=
mro_C3_merge
(
inputs
)
return
self
.
_mro
def
empty_declaration_code
(
self
):
if
self
.
_empty_declaration
is
None
:
self
.
_empty_declaration
=
self
.
declaration_code
(
''
,
deref
=
1
)
...
...
Cython/Compiler/Symtab.py
View file @
4e3c2d75
...
...
@@ -734,6 +734,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