Can you produce a testcase for this issue?&nbsp; It is *critical* for fast symbolics in Sage, so I would prefer to fix the bug as opposed to reverting. I see the problem now, but I will need the test cases you are using to produce a fix.&nbsp; Once I have them it should be a relatively easy patch. <br>

<br><div class="gmail_quote">On Tue, Apr 8, 2008 at 11:50 AM, Stefan Behnel &lt;<a href="mailto:stefan_ml@behnel.de" target="_blank">stefan_ml@behnel.de</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

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