[Cython] Strange cimport behaviour
Robert Bradshaw
robertwb at math.washington.edu
Thu Jul 21 12:16:34 CEST 2011
On Thu, Jul 21, 2011 at 2:28 AM, Lars Buitinck <L.J.Buitinck at uva.nl> wrote:
> 2011/7/21 Robert Bradshaw <robertwb at math.washington.edu>:
>> On Wed, Jul 20, 2011 at 10:30 PM, Robert Bradshaw
>> <robertwb at math.washington.edu> wrote:
>>> On Wed, Jul 20, 2011 at 9:40 PM, Vitja Makarov <vitja.makarov at gmail.com> wrote:
>>>> 2011/7/21 Robert Bradshaw <robertwb at math.washington.edu>:
>>>>> I'm not sure what we can do here--we make sure to emit the #include
>>>>> statements in the same order as they are encountered in the Cython
>>>>> sources because C is sensitive to this kind of thing, but we can't
>>>>> really "fix" C. I suppose we could cimport posix.fcntl from within
>>>>> posix.unistd to force an ordering.
>>
>> https://github.com/cython/cython/commit/55d5e576935d83c6bdadc593e36793aecffe0bae
>
> I'm not familiar enough with the Cython internals to understand this
> change; are #includes now generated in the C code in the order of the
> corresponding cimports?
Yes. Essentially, imagine every time you see a "cdef extern from
'header.h'" you add 'header.h' to your ordered list of #includes (if
it's not already there), and when you encounter a cimport, you "step
into" it and gather all the #includes it has before moving on.
- Robert
More information about the cython-devel
mailing list