[Numpy-discussion] Detecting C API mismatch (was Managing Python with NumPy and many external libraries on multiple Windows machines)
Charles R Harris
Sun May 10 11:13:32 CDT 2009
On Sat, May 9, 2009 at 11:45 PM, David Cournapeau <email@example.com>wrote:
> I worked on some code to detect C API mismatches both for developers
> and for users:
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion