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
7825019d
Commit
7825019d
authored
May 23, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Predeclare a cypclass PyTyObject directly instead of predeclaring a pointer
parent
937a8991
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
Cython/Compiler/CypclassWrapper.py
Cython/Compiler/CypclassWrapper.py
+3
-3
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+1
-1
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+2
-1
No files found.
Cython/Compiler/CypclassWrapper.py
View file @
7825019d
...
...
@@ -84,7 +84,7 @@ def cypclass_iter_scopes(scope):
def
generate_cypclass_typeobj_declarations
(
env
,
code
,
definition
):
"""
Generate
declarations of global pointers to
the PyTypeObject for each cypclass
Generate
pre-declarations of
the PyTypeObject for each cypclass
"""
for
entry
in
cypclass_iter
(
env
):
...
...
@@ -93,7 +93,7 @@ def generate_cypclass_typeobj_declarations(env, code, definition):
# actually returns an instance of the cypclass type.
# and do this computation only once
# (cf generate_cyp_class_wrapper_definition)
code
.
putln
(
"static PyTypeObject
*%s = 0;"
%
(
entry
.
type
.
typeptr
_cname
))
code
.
putln
(
"static PyTypeObject
%s;"
%
(
entry
.
type
.
typeobj
_cname
))
...
...
@@ -595,7 +595,7 @@ def generate_cyp_class_wrapper_definition(type, wrapper_entry, constructor_entry
code
.
putln
(
"if(self) {"
)
code
.
putln
(
"self->ob_refcnt = 0;"
)
# code.putln("self->ob_type = NULL;")
code
.
putln
(
"self->ob_type =
%s;"
%
type
.
typeptr
_cname
)
code
.
putln
(
"self->ob_type =
&%s;"
%
type
.
typeobj
_cname
)
code
.
putln
(
"}"
)
if
init_entry
:
...
...
Cython/Compiler/PyrexTypes.py
View file @
7825019d
...
...
@@ -4182,7 +4182,7 @@ class CypClassType(CppClassType):
self
.
lock_mode
=
lock_mode
if
lock_mode
else
"autolock"
self
.
activable
=
activable
self
.
_mro
=
None
self
.
type
ptr
_cname
=
None
# set externally
self
.
type
obj
_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 @
7825019d
...
...
@@ -737,7 +737,8 @@ 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
.
c_mangle
(
Naming
.
typeptr_prefix
,
name
)
# generate PyTypeObject cname for cypclass
type
.
typeobj_cname
=
self
.
c_mangle
(
Naming
.
typeobj_prefix
,
name
)
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