Hi, Gary Furnish wrote: > This patch adds extra logic to code generation to sort dependencies to > guarantee that C code is generated in the right order for circular cdef > imports. It does NOT solve python circular import issues. > a.pyx: cimport b > b.pyx: cimport a > Is thus legal, but you can not reference a or b in the global namespace of > b.pyx or a.pyx (such as to instantiate a class). > This patch also modifies cython to output the exact line in the C code where > an exception was thrown in addition to the currently displayed pyx file and > line. This enables significantly faster developmental debugging. > Finally it splits module initialization into two phases: one that initiates > types and handles imports, and another that executes python commands at the > global namespace level. This will be more useful as Cython starts to assume > more advanced optimization and code generation features > The patch is available at: > http://trac.sagemath.org/sage_trac/ticket/2655(the third attachment > only) and is based against 0.9.6.12, > although I can rebase if needed. I am hoping this can be merged into > Cython.
The patch doesn't work for me. When I fix the problems with the header file generation, I end up with C code that defines the "__pyx_obj_*" class structs in the wrong order. Note that there are no circular dependencies involved in my case and that the two classes where the problem occurs are defined in the same source file (although their highest base class is defined in a separate file, not sure if that matters. Personally, seeing all problems I have with this patch and not really seeing a clear gain, I would just revert the patch for now. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
