[Numpy-discussion] Detecting C API mismatch (was Managing Python with NumPy and many external libraries on multiple Windows machines)
Charles R Harris
charlesr.harris at gmail.com
Sun May 10 12:13:32 EDT 2009
On Sat, May 9, 2009 at 11:45 PM, David Cournapeau <cournape at gmail.com>wrote:
> Hi,
>
> I worked on some code to detect C API mismatches both for developers
> and for users:
>
> http://github.com/cournape/numpy/tree/runtime_feature
>
> It adds the following:
> - if a numpy or ufunc function is added in the C API without the
> NPY_FEATURE_VERSION to be updated, a warning is generated at built
> time (the warning is turned into an exception for release)
> - I added a function PyArray_GetNDArrayCFeatureVersion which returns
> the C API version, and the version is checked in import_array. If the
> compile-time version > import-time version, an import error is raised,
> so the following happens (assuming the ABI is not changed).
>
> So we keep backward compatibility (building an extension with say
> numpy 1.2.1 will still work after installing numpy 1.3), and forward
> incompatibility is detected (building an extension with numpy 1.3.0
> and importing it with installed numpy 1.2.1 will fail).
>
> Ironically, adding the function means that we have to add one function
> to the C API, so this will not be useful for numpy < 1.4, but I don't
> think it is possible to do it without modifying the C API.
>
Why not just use the current API to get the number? That looks easy to do,
what is the problem? I'll fix it up if you want.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090510/de8397cb/attachment.html>
More information about the NumPy-Discussion
mailing list