[Numpy-discussion] Some incompatibilities in numpy trunk

Gael Varoquaux gael.varoquaux@normalesup....
Sun Dec 6 07:53:58 CST 2009


I have a lot of code that has stopped working with my latest SVN pull to
numpy.

* Some compiled code yields an error looking like (from memory):

    "incorrect type 'numpy.ndarray'"

Rebuilding it is sufficient.

* I had some code doing:

    hashlib.md5(x).hexdigest()

where x is a numpy array. I had to replace it by:

    hashlib.md5(np.getbuffer(x)).hexdigest()

* Finally, I had to following failure:

  /home/varoquau/dev/enthought/ets/Mayavi_3.1.0/enthought/tvtk/array_handler.pyc
  in array2vtk(num_array, vtk_array)
  --> 298     result_array.SetVoidArray(z_flat, len(z_flat), 1)

  TypeError: argument 1 must be string or read-only buffer, not
  numpy.ndarray

  I can solve the problem using:

    result_array.SetVoidArray(numpy.getbuffer(z_flat), len(z_flat), 1)

However, I am wondering: is this some incompatibility that has been
introduced by mistake? I find it a bit strange that a '.x' release
induces so much breakage, and I am afraid that it won't be popular
amongst our users.

Cheers,

Gaël


More information about the NumPy-Discussion mailing list