Dag Sverre Seljebotn wrote:
>> Hi all,
>>
>> I've spent the day writing a Numpy format handler in Cython and thought
>> there were a few things that the Cython numpy tutorial possibly should
>> cover:
>>
>
> Are you talking about wiki.cython.org/tutorials/numpy? I think that's
> targeted to a a different audience who don't immedeately feel comfortable
> calling the NumPy C API...
>
Hmm, good point.
>> * You have to call import_array() in your module or many of the
>> Numpy C API entry points will segfault
>>
>
> Are you sure about this? I never do it. I know you need to do it from C
> code, but is it not enough in Cython to do
>
> import numpy
>
> ?
>
> Did you actually get a segfault using Cython? Could you send me an
> example? I'd really like to make this automatic somehow.
>
Sure, check out PyOpenGL head:
bzr branch lp:pyopengl
comment out the import_array() at the end of src/numpy_formathandler.pyx
run:
python setupaccel.py build_ext --inplace --force
to build the extensions switch to the tests directory and run:
nosetests -sv test_numpyaccel.py
you'll get a segfault in test_asArray (or at least, I do).
>> Anyway, not sure if or where such changes should go, but just thought it
>> might help others.
>>
>
> I you feel it fits within the tutorial feel free to add it there,
> otherwise you can always create a sub-page about "Using the NumPy C API"
> or somesuch.
>
> Dag Sverre
>
Thanks kindly,
Mike
--
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev