[Cython] Strange cimport behaviour

Vitja Makarov vitja.makarov at gmail.com
Thu Jul 21 06:40:58 CEST 2011


2011/7/21 Robert Bradshaw <robertwb at math.washington.edu>:
> On Wed, Jul 20, 2011 at 9:27 PM, Vitja Makarov <vitja.makarov at gmail.com> wrote:
>> 2011/7/16 Lars Buitinck <L.J.Buitinck at uva.nl>:
>>> 2011/7/15 Vitja Makarov <vitja.makarov at gmail.com>:
>>>> I've found strange bug. In my example cimport misses "fcntl.h" include:
>>>>
>>>> ((c2f2e12...)) vitja at vitja-laptop:~/work/cython-vitek/zzz$ cat ./fff.pyx
>>>> cimport posix.unistd
>>>> cimport posix.fcntl
>>>>
>>>> print posix.fcntl.O_RDWR
>>>
>>> Fascinating; I can reproduce the error (on Scientific Linux 5.5), but
>>> it goes away when I reverse the order of the includes.
>>>
>>
>> What's about this issue? Is that easy to fix before release or it's
>> better to create a ticket?
>
> 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.
>

That's not C bug. That's cython bug. Actualy fcntl.h isn't included at all.
That seems to be a problem with cimport and packages.

As I said "from posix cimport unistd, fcntl" works just fine.

-- 
vitja.


More information about the cython-devel mailing list