Commit 76d2ecbb authored by Nikita Nemkin's avatar Nikita Nemkin

Order cdef classes by inheritance before generating the code.

parent dfdfc93f
......@@ -106,6 +106,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self.find_referenced_modules(env, self.referenced_modules, {})
if options.recursive:
self.generate_dep_file(env, result)
self.sort_cdef_classes(env)
self.generate_c_code(env, options, result)
self.generate_h_code(env, options, result)
self.generate_api_code(env, result)
......@@ -455,6 +456,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
return (vtab_list, vtabslot_list)
def sort_cdef_classes(self, env):
entry_dict = {}
for entry in env.c_class_entries:
entry_dict[entry.name] = entry
def entry_name(entry):
return entry.name
env.c_class_entries[:] = self.sort_types_by_inheritance(entry_dict, entry_name)
def generate_type_definitions(self, env, modules, vtab_list, vtabslot_list, code):
# TODO: Why are these separated out?
for entry in vtabslot_list:
......
cimport cython
cdef class B
cdef class A(object):
cdef list dealloc1
cdef class B(A):
cdef list dealloc2
def test():
"""
>>> test()
"""
A(), B()
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