[Numpy-discussion] binary builds against older numpys

Stéfan van der Walt stefan@sun.ac...
Wed May 20 15:10:24 CDT 2009


Hi John

2009/5/20  <josef.pktd@gmail.com>:
> On Wed, May 20, 2009 at 3:07 PM, John Hunter <jdh2358@gmail.com> wrote:
>> We are trying to build and test mpl installers for python2.4, 2.5 and
>> 2.6.  What we are finding is that if we build mpl against a more
>> recent numpy than the installed numpy on a test machine, the import of
>> mpl extension modules which depend on numpy trigger a segfault.

I think we accidentally forgot to increase the API version at some
stage (bad), but we now have checks in place to catch these
mismatches.

Specifically, import_array makes sure that the ABI versions agree, and
that the API is the same or newer:

  if (NPY_VERSION != PyArray_GetNDArrayCVersion()) {
    PyErr_Format(PyExc_RuntimeError, "module compiled against "\
        "ABI version %%x but this version of numpy is %%x", \
        (int) NPY_VERSION, (int) PyArray_GetNDArrayCVersion());
    return -1;
  }
  if (NPY_FEATURE_VERSION > PyArray_GetNDArrayCFeatureVersion()) {
    PyErr_Format(PyExc_RuntimeError, "module compiled against "\
        "API version %%x but this version of numpy is %%x", \
        (int) NPY_FEATURE_VERSION, (int) PyArray_GetNDArrayCFeatureVersion());
    return -1;
  }

David Cournapeau also put a check in place so that the NumPy build
will break if we forget to update the API version again.

So, while we can't change the releases of NumPy out there already, we
can at least ensure that this won't happen again.

Regards
Stéfan


More information about the Numpy-discussion mailing list