[Cython] circular cimports
David Harvey
dmharvey at math.harvard.edu
Mon Feb 25 05:18:05 CET 2008
Hi,
In Sage, if I try to add
from sage.rings.integer cimport Integer
at the top of sage/misc/misc_c.pyx, everything compiles fine, but
then I get some weird import error when I start up sage.
(I'm sorry, I don't know enough about cython to reproduce this in a
standalone cython program, I only know how to make it happen in sage.)
It looks like a "circular cimport problem". I found this post by Greg
Ewing which seems relevant, but it's a bit old now, and I don't quite
understand what he's saying:
http://osdir.com/ml/python.pyrex/2006-06/msg00020.html
Is there any way to successfully cimport Integer into that module? Or
do I need to just put the code that references Integer in some other
random place which is guaranteed to get loaded after
sage.rings.integer? (This would be a bit annoying....)
I don't quite understand why circular cimports should exist, since I
thought these kinds of things got resolved at compile time.
david
More information about the Cython-dev
mailing list