[Cython] Robert: numpy.pxd etc.
Robert Bradshaw
robertwb at math.washington.edu
Tue Jul 7 12:30:24 CEST 2009
On Jul 5, 2009, at 12:04 PM, Dag Sverre Seljebotn wrote:
> Dag Sverre Seljebotn wrote:
>> (Context:
>>
>> http://trac.cython.org/cython_trac/ticket/339
>> http://trac.sagemath.org/sage_trac/ticket/4571
>> )
>>
>> I want to use Sage to demo Cython at SciPy 09, so I'm going to
>> take care
>> of #339 within a day or so. I'm thinking about doing it against the
>> cython repo, so that 0.11.2.1 could be released and it could go into
>> Sage right away, what do you think about that? (There's already a
>> regression bugfix in there).
>>
>> A problem with the merge is that in Cython's numpy.pxd many fields
>> are
>> kept as Python (e.g. flags), for better API compatability with
>> Python.
>>
>> This is a fundamental problem (and I'm not sure I like the
>> "solution" I
>> went for), but at least for now I'll do something like this:
>>
>> ctypedef extern class numpy.ndarray [object PyArrayObject]:
>> ...
>> cdef int c_flags "flags"
>>
>> so that the Python name is the default. It's easier to change Sage
>> here
>> than to break backwards compatability.
>>
>
> Actually, I reconsidered: I will not in general make the C fields
> available at all; since the NumPy recommandation is to use macros
> (like
> PyArray_CHKFLAGS and so on) anyway.
Even better. (I really should stick to answering emails in reverse
order...)
- Robert
More information about the Cython-dev
mailing list