Commit cf2ffbcc authored by Robert Bradshaw's avatar Robert Bradshaw

Cleanup.

parent c2e7b11e
...@@ -2875,7 +2875,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -2875,7 +2875,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self.generate_base_type_import_code(env, entry, code) self.generate_base_type_import_code(env, entry, code)
self.generate_exttype_vtable_init_code(entry, code) self.generate_exttype_vtable_init_code(entry, code)
if entry.type.early_init: if entry.type.early_init:
self.generate_type_ready_code(entry, code) self.generate_type_ready_code(entry, code)
def generate_base_type_import_code(self, env, entry, code): def generate_base_type_import_code(self, env, entry, code):
base_type = entry.type.base_type base_type = entry.type.base_type
......
This diff is collapsed.
...@@ -3439,10 +3439,10 @@ def p_c_class_definition(s, pos, ctx): ...@@ -3439,10 +3439,10 @@ def p_c_class_definition(s, pos, ctx):
if s.sy == '(': if s.sy == '(':
positional_args, keyword_args = p_call_parse_args(s, allow_genexp=False) positional_args, keyword_args = p_call_parse_args(s, allow_genexp=False)
if keyword_args: if keyword_args:
s.error("C classes cannot take keyword bases.") s.error("C classes cannot take keyword bases.")
bases, _ = p_call_build_packed_args(pos, positional_args, keyword_args) bases, _ = p_call_build_packed_args(pos, positional_args, keyword_args)
if bases is None: if bases is None:
bases = ExprNodes.TupleNode(pos, args=[]) bases = ExprNodes.TupleNode(pos, args=[])
if s.sy == '[': if s.sy == '[':
if ctx.visibility not in ('public', 'extern') and not ctx.api: if ctx.visibility not in ('public', 'extern') and not ctx.api:
......
cdef class CBase(object): cdef class CBase(object):
cdef int a cdef int a
cdef c_method(self): cdef c_method(self):
return "CBase" return "CBase"
cpdef cpdef_method(self): cpdef cpdef_method(self):
return "CBase" return "CBase"
class PyBase(object): class PyBase(object):
def py_method(self): def py_method(self):
return "PyBase" return "PyBase"
cdef class Both(CBase, PyBase): cdef class Both(CBase, PyBase):
cdef dict __dict__ cdef dict __dict__
""" """
>>> b = Both() >>> b = Both()
>>> b.py_method() >>> b.py_method()
'PyBase' 'PyBase'
>>> b.cp_method() >>> b.cp_method()
'Both' 'Both'
>>> b.call_c_method() >>> b.call_c_method()
'Both' 'Both'
>>> isinstance(b, CBase) >>> isinstance(b, CBase)
True True
>>> isinstance(b, PyBase) >>> isinstance(b, PyBase)
True True
""" """
cdef c_method(self): cdef c_method(self):
return "Both" return "Both"
cpdef cp_method(self): cpdef cp_method(self):
return "Both" return "Both"
def call_c_method(self): def call_c_method(self):
return self.c_method() return self.c_method()
cdef class BothSub(Both): cdef class BothSub(Both):
""" """
>>> b = BothSub() >>> b = BothSub()
>>> b.py_method() >>> b.py_method()
'PyBase' 'PyBase'
>>> b.cp_method() >>> b.cp_method()
'Both' 'Both'
>>> b.call_c_method() >>> b.call_c_method()
'Both' 'Both'
""" """
pass pass
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment