Hi! I've found strange bug. In my example cimport misses "fcntl.h" include: ((c2f2e12...)) vitja@vitja-laptop:~/work/cython-vitek/zzz$ cat ./fff.pyx cimport posix.unistd cimport posix.fcntl print posix.fcntl.O_RDWR ((c2f2e12...)) vitja@vitja-laptop:~/work/cython-vitek/zzz$ make fff.so /usr//bin/python ../cython.py --gdb -v fff.pyx -o fff.c Compiling /home/vitja/work/cython-vitek/zzz/fff.pyx gcc -O0 -g3 -fPIC -I/usr//include/python2.6 -g3 -W -c -o fff.o fff.c fff.c: In function 'initfff': fff.c:537: error: 'O_RDWR' undeclared (first use in this function) fff.c:537: error: (Each undeclared identifier is reported only once fff.c:537: error: for each function it appears in.) make: *** [fff.o] Ошибка 1 -- vitja.
15 июля 2011 г. 23:32 пользователь Vitja Makarov <vitja.makarov@gmail.com> написал:
Hi!
I've found strange bug. In my example cimport misses "fcntl.h" include:
((c2f2e12...)) vitja@vitja-laptop:~/work/cython-vitek/zzz$ cat ./fff.pyx cimport posix.unistd cimport posix.fcntl
print posix.fcntl.O_RDWR
((c2f2e12...)) vitja@vitja-laptop:~/work/cython-vitek/zzz$ make fff.so /usr//bin/python ../cython.py --gdb -v fff.pyx -o fff.c Compiling /home/vitja/work/cython-vitek/zzz/fff.pyx gcc -O0 -g3 -fPIC -I/usr//include/python2.6 -g3 -W -c -o fff.o fff.c fff.c: In function 'initfff': fff.c:537: error: 'O_RDWR' undeclared (first use in this function) fff.c:537: error: (Each undeclared identifier is reported only once fff.c:537: error: for each function it appears in.) make: *** [fff.o] Ошибка 1
Btw, from posix cimport unistd, fcntl works as expected -- vitja.
2011/7/15 Vitja Makarov <vitja.makarov@gmail.com>:
I've found strange bug. In my example cimport misses "fcntl.h" include:
((c2f2e12...)) vitja@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. -- Lars Buitinck Scientific programmer, ILPS University of Amsterdam
2011/7/16 Lars Buitinck <L.J.Buitinck@uva.nl>:
2011/7/15 Vitja Makarov <vitja.makarov@gmail.com>:
I've found strange bug. In my example cimport misses "fcntl.h" include:
((c2f2e12...)) vitja@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? -- vitja.
On Wed, Jul 20, 2011 at 9:27 PM, Vitja Makarov <vitja.makarov@gmail.com> wrote:
2011/7/16 Lars Buitinck <L.J.Buitinck@uva.nl>:
2011/7/15 Vitja Makarov <vitja.makarov@gmail.com>:
I've found strange bug. In my example cimport misses "fcntl.h" include:
((c2f2e12...)) vitja@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. - Robert
2011/7/21 Robert Bradshaw <robertwb@math.washington.edu>:
On Wed, Jul 20, 2011 at 9:27 PM, Vitja Makarov <vitja.makarov@gmail.com> wrote:
2011/7/16 Lars Buitinck <L.J.Buitinck@uva.nl>:
2011/7/15 Vitja Makarov <vitja.makarov@gmail.com>:
I've found strange bug. In my example cimport misses "fcntl.h" include:
((c2f2e12...)) vitja@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.
On Wed, Jul 20, 2011 at 9:40 PM, Vitja Makarov <vitja.makarov@gmail.com> wrote:
2011/7/21 Robert Bradshaw <robertwb@math.washington.edu>:
On Wed, Jul 20, 2011 at 9:27 PM, Vitja Makarov <vitja.makarov@gmail.com> wrote:
2011/7/16 Lars Buitinck <L.J.Buitinck@uva.nl>:
2011/7/15 Vitja Makarov <vitja.makarov@gmail.com>:
I've found strange bug. In my example cimport misses "fcntl.h" include:
((c2f2e12...)) vitja@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.
I thought you meant that cimport posix.fcntl cimport posix.unistd worked but cimport posix.unistd cimport posix.fcntl didn't. I'm seeing the bug now. (There are of course cases where one does care about import order.) - Robert
On Wed, Jul 20, 2011 at 10:30 PM, Robert Bradshaw <robertwb@math.washington.edu> wrote:
On Wed, Jul 20, 2011 at 9:40 PM, Vitja Makarov <vitja.makarov@gmail.com> wrote:
2011/7/21 Robert Bradshaw <robertwb@math.washington.edu>:
On Wed, Jul 20, 2011 at 9:27 PM, Vitja Makarov <vitja.makarov@gmail.com> wrote:
2011/7/16 Lars Buitinck <L.J.Buitinck@uva.nl>:
2011/7/15 Vitja Makarov <vitja.makarov@gmail.com>:
I've found strange bug. In my example cimport misses "fcntl.h" include:
((c2f2e12...)) vitja@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.
I thought you meant that
cimport posix.fcntl cimport posix.unistd
worked but
cimport posix.unistd cimport posix.fcntl
didn't. I'm seeing the bug now. (There are of course cases where one does care about import order.)
https://github.com/cython/cython/commit/55d5e576935d83c6bdadc593e36793aecffe...
2011/7/21 Robert Bradshaw <robertwb@math.washington.edu>:
On Wed, Jul 20, 2011 at 10:30 PM, Robert Bradshaw <robertwb@math.washington.edu> wrote:
On Wed, Jul 20, 2011 at 9:40 PM, Vitja Makarov <vitja.makarov@gmail.com> wrote:
2011/7/21 Robert Bradshaw <robertwb@math.washington.edu>:
On Wed, Jul 20, 2011 at 9:27 PM, Vitja Makarov <vitja.makarov@gmail.com> wrote:
2011/7/16 Lars Buitinck <L.J.Buitinck@uva.nl>:
2011/7/15 Vitja Makarov <vitja.makarov@gmail.com>: > I've found strange bug. In my example cimport misses "fcntl.h" include: > > ((c2f2e12...)) vitja@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.
I thought you meant that
cimport posix.fcntl cimport posix.unistd
worked but
cimport posix.unistd cimport posix.fcntl
didn't. I'm seeing the bug now. (There are of course cases where one does care about import order.)
https://github.com/cython/cython/commit/55d5e576935d83c6bdadc593e36793aecffe...
Cool, thanks! -- vitja.
2011/7/21 Robert Bradshaw <robertwb@math.washington.edu>:
On Wed, Jul 20, 2011 at 10:30 PM, Robert Bradshaw <robertwb@math.washington.edu> wrote:
On Wed, Jul 20, 2011 at 9:40 PM, Vitja Makarov <vitja.makarov@gmail.com> wrote:
2011/7/21 Robert Bradshaw <robertwb@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/55d5e576935d83c6bdadc593e36793aecffe...
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? -- Lars Buitinck Scientific programmer, ILPS University of Amsterdam
On Thu, Jul 21, 2011 at 2:28 AM, Lars Buitinck <L.J.Buitinck@uva.nl> wrote:
2011/7/21 Robert Bradshaw <robertwb@math.washington.edu>:
On Wed, Jul 20, 2011 at 10:30 PM, Robert Bradshaw <robertwb@math.washington.edu> wrote:
On Wed, Jul 20, 2011 at 9:40 PM, Vitja Makarov <vitja.makarov@gmail.com> wrote:
2011/7/21 Robert Bradshaw <robertwb@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/55d5e576935d83c6bdadc593e36793aecffe...
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
Lars Buitinck, 21.07.2011 11:28:
2011/7/21 Robert Bradshaw:
https://github.com/cython/cython/commit/55d5e576935d83c6bdadc593e36793aecffe...
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?
That's been the case for several releases already. The change above only fixes a glitch where the #include was not generated at all. Stefan
participants (4)
-
Lars Buitinck -
Robert Bradshaw -
Stefan Behnel -
Vitja Makarov