cython/cython — pull request #223 by nnemkin (2013-05-05 14:13:55+00:00)
Title: Order cdef classes by inheritance before generating the code.

cdef classes must be (topologically) ordered by inheritance to satisfy the following dependencies:
1) dealloc function definition: derived classes call base class dealloc;
2) vtable pointer initialization in module init function.
Wrong order causes C/C++ compilation failure for 1) and segfault on import for 2).

Normally, source order is the correct order, but forward declarations can change this. See included test case for example.
I hit this problem because I forward declare all my classes in alphabetic order (and then include class definitions from .pxi files, one class per file).

The simple (although not obvious) workaround is to reorder forward delarations, but I believe it's worth fixing permanently.