On Tue, Dec 8, 2009 at 5:11 AM, Dag Sverre Seljebotn
<[email protected]> wrote:
> Lisandro Dalcin wrote:
>> On Mon, Dec 7, 2009 at 3:29 PM, Robert Bradshaw
>> <[email protected]> wrote:
>>> Is there a way to detect whether the way its been changed is backward
>>> compatible?
>>>
>>
>> NumPy exposes an API version number. However, I'm not sure if that
>> would be enough to detect if a change is backwards.
>
> Talking about NumPy-specific solutions, this was improved in 1.4.0 with
> several kind of version numbers depending on how things are breaked.
>
> http://docs.scipy.org/doc/numpy/reference/c-api.array.html#checking-the-api-version
>

To complete Dag explanation, numpy C API has two numbers:

 - ABI: the one obtained from PyArray_GetNDArrayCVersion. Every
extension using the C numpy api must have exactly the same number.
This is normally checked at import time since forever.
 - API: the one obtained PyArray_GetNDArrayCFeatureVersion. Every time
the C API is extended, we increase this number. This is only available
since 1.4.0

The basic rule is that two extensions ext 1 and ext 2 are compatible
iif  ABI_1 == ABI_2 == NUMPY_ABI and API_1 >= API_2 >= NUMPY_API. This
rule is what is checked for since 1.4.0.

Note that this is as reliable as we are tracking changes in the ABI -
it is unfortunately quite difficult to guarantee that we have not
broken the ABI between two versions (it is already difficult in pure
C, but it is worse with python extensions because we don't have the
linker safety net, nor do we have versioned symbols).

cheers,

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

Reply via email to