On Wed, Apr 29, 2009 at 12:37 PM, Robert Bradshaw
<[email protected]> wrote:
> On Apr 29, 2009, at 11:55 AM, Ondrej Certik wrote:
>
>> Hi,
>>
>> I am having a problem getting the pure mode run (I think this used to
>> work before). Here is my cx.pyx file:
>>
>> -------------
>> import cython
>>
>> from numpy import array
>>
>> #[email protected](x=cython.int)
>> def f(x):
>>     r = cython.declare(cython.int)
>>     i = cython.declare(cython.int)
>>     if x > 0:
>>         r = 1
>>         for i in range(1, x):
>>             r *= i
>>         return r
>>     else:
>>         return 0
>>
>> def f_vectorized(a):
>>     return array([f(x) for x in a])
>> ----------
>>
>> and here is my cx.pxd file:
>> -----
>> cdef int f(int x)
>> -------
>>
>> If I compile it:
>>
>> $ cython cx.pyx
>> warning: /home/ondrej/repos/cython_test/cx.pyx:6:0: Overriding cdef
>> method with def method.
>>
>>
>> it doesn't build:
>>
>> gcc -fPIC -O3 -I/usr/include/python2.6 -c -o cx.o cx.c
>> cx.c:196: warning: ‘__pyx_f_2cx_f’ used but never defined
>> gcc -fPIC -O3 -shared -o cx.so cx.o
>> /usr/bin/ld: cx.o: relocation R_X86_64_PC32 against undefined symbol
>> `__pyx_f_2cx_f' can not be used when making a shared object; recompile
>> with -fPIC
>> /usr/bin/ld: final link failed: Bad value
>> collect2: ld returned 1 exit status
>> make: *** [cx.so] Error 1
>>
>>
>> If I delete the pxd file, it works fine (but it's not a cdef function,
>> so it's slow).
>
> Not sure--have you tried without the locals decorator in the Python
> source? I hope this isn't a regression.

Yes, as you can see, the locals is commented out. I'll try to bisect
it to see which commit broke it.

Ondrej
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to