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
Kirill Smelkov
cython
Commits
e9aa3db7
Commit
e9aa3db7
authored
Apr 10, 2021
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unconditionally use modified PyType_Ready.
This fixes github issue #4106.
parent
217a93e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
16 deletions
+54
-16
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+10
-16
tests/run/cdef_multiple_inheritance_cimport.srctree
tests/run/cdef_multiple_inheritance_cimport.srctree
+44
-0
No files found.
Cython/Compiler/Nodes.py
View file @
e9aa3db7
...
...
@@ -5246,13 +5246,13 @@ 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
,
True
)
self
.
generate_type_ready_code
(
self
.
entry
,
code
)
if
self
.
body
:
self
.
body
.
generate_execution_code
(
code
)
# Also called from ModuleNode for early init types.
@
staticmethod
def
generate_type_ready_code
(
entry
,
code
,
heap_type_bases
=
False
):
def
generate_type_ready_code
(
entry
,
code
):
# Generate a call to PyType_Ready for an extension
# type defined in this module.
type
=
entry
.
type
...
...
@@ -5288,15 +5288,10 @@ class CClassDefNode(ClassDefNode):
code
.
putln
(
"#else"
)
for
slot
in
TypeSlots
.
slot_table
:
slot
.
generate_dynamic_init_code
(
scope
,
code
)
if
heap_type_bases
:
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
'PyType_Ready'
,
'ExtensionTypes.c'
))
readyfunc
=
"__Pyx_PyType_Ready"
else
:
readyfunc
=
"PyType_Ready"
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
'PyType_Ready'
,
'ExtensionTypes.c'
))
code
.
putln
(
"if (%s(&%s) < 0) %s"
%
(
readyfunc
,
"if (__Pyx_PyType_Ready(&%s) < 0) %s"
%
(
typeobj_cname
,
code
.
error_goto
(
entry
.
pos
)))
# Don't inherit tp_print from builtin types in Python 2, restoring the
...
...
@@ -5375,12 +5370,11 @@ class CClassDefNode(ClassDefNode):
type
.
vtabptr_cname
,
code
.
error_goto
(
entry
.
pos
)))
code
.
putln
(
"#endif"
)
if
heap_type_bases
:
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
'MergeVTables'
,
'ImportExport.c'
))
code
.
putln
(
"if (__Pyx_MergeVtables(&%s) < 0) %s"
%
(
typeobj_cname
,
code
.
error_goto
(
entry
.
pos
)))
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
'MergeVTables'
,
'ImportExport.c'
))
code
.
putln
(
"if (__Pyx_MergeVtables(&%s) < 0) %s"
%
(
typeobj_cname
,
code
.
error_goto
(
entry
.
pos
)))
if
not
type
.
scope
.
is_internal
and
not
type
.
scope
.
directives
.
get
(
'internal'
):
# scope.is_internal is set for types defined by
# Cython (such as closures), the 'internal'
...
...
tests/run/cdef_multiple_inheritance_cimport.srctree
0 → 100644
View file @
e9aa3db7
# Test for https://github.com/cython/cython/issues/4106
PYTHON setup.py build_ext --inplace
PYTHON -c "import sub"
######## setup.py ########
from Cython.Build import cythonize
from distutils.core import setup
setup(
ext_modules = cythonize("*.pyx"),
)
######## base.pxd ########
cdef class A:
cdef dict __dict__
cdef int a(self)
cdef class B(A):
cdef int b(self)
######## base.pyx ########
cdef class A:
cdef int a(self):
return 1
class PyA:
pass
cdef class B(A, PyA):
cdef int b(self):
return 2
######## sub.pyx ########
from base cimport B
print(B)
cdef class C(B):
cdef int c(self):
return 3
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