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
Xavier Thompson
cython
Commits
da62546f
Commit
da62546f
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
d34a40d0
Changes
3
Hide 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 @
da62546f
...
...
@@ -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 @
da62546f
...
...
@@ -3905,7 +3905,7 @@ class CypClassType(CppClassType):
CppClassType
.
__init__
(
self
,
name
,
scope
,
cname
,
base_classes
,
templates
,
template_type
,
nogil
)
self
.
lock_mode
=
lock_mode
if
lock_mode
else
"autolock"
self
.
activable
=
activable
self
.
type
ptr
_cname
=
None
# set externally
self
.
type
obj
_cname
=
None
# set externally
def
empty_declaration_code
(
self
):
...
...
Cython/Compiler/Symtab.py
View file @
da62546f
...
...
@@ -672,7 +672,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