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
Boxiang Sun
cython
Commits
c2e7b11e
Commit
c2e7b11e
authored
7 years ago
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Py3.5+ fix.
parent
7e3cbdc7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+16
-2
No files found.
Cython/Compiler/Nodes.py
View file @
c2e7b11e
...
...
@@ -4751,11 +4751,11 @@ class CClassDefNode(ClassDefNode):
self
.
type_init_args
.
generate_disposal_code
(
code
)
self
.
type_init_args
.
free_temps
(
code
)
self
.
generate_type_ready_code
(
self
.
entry
,
code
)
self
.
generate_type_ready_code
(
self
.
entry
,
code
,
True
)
# Also called from ModuleNode for early init types.
@
staticmethod
def
generate_type_ready_code
(
entry
,
code
):
def
generate_type_ready_code
(
entry
,
code
,
heap_type_bases
=
False
):
# Generate a call to PyType_Ready for an extension
# type defined in this module.
type
=
entry
.
type
...
...
@@ -4765,10 +4765,24 @@ class CClassDefNode(ClassDefNode):
if
entry
.
visibility
!=
'extern'
:
for
slot
in
TypeSlots
.
slot_table
:
slot
.
generate_dynamic_init_code
(
scope
,
code
)
if
heap_type_bases
:
# As of https://bugs.python.org/issue22079
# PyType_Ready enforces that all bases of a non-heap type
# are non-heap. We know this is the case for the solid base,
# but other bases may be heap allocated and are kept alive
# though the bases reference.
# Other than this check, this flag is unused in this method.
code
.
putln
(
"#if PY_VERSION_HEX >= 0x03050000"
)
code
.
putln
(
"%s.tp_flags |= Py_TPFLAGS_HEAPTYPE;"
%
typeobj_cname
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"if (PyType_Ready(&%s) < 0) %s"
%
(
typeobj_cname
,
code
.
error_goto
(
entry
.
pos
)))
if
heap_type_bases
:
code
.
putln
(
"#if PY_VERSION_HEX >= 0x03050000"
)
code
.
putln
(
"%s.tp_flags &= ~Py_TPFLAGS_HEAPTYPE;"
%
typeobj_cname
)
code
.
putln
(
"#endif"
)
# Don't inherit tp_print from builtin types, restoring the
# behavior of using tp_repr or tp_str instead.
code
.
putln
(
"%s.tp_print = 0;"
%
typeobj_cname
)
...
...
This diff is collapsed.
Click to expand it.
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