[Numpy-discussion] Some incompatibilities in numpy trunk

Pauli Virtanen pav@iki...
Sun Dec 6 08:07:16 CST 2009


su, 2009-12-06 kello 14:53 +0100, Gael Varoquaux kirjoitti:
> I have a lot of code that has stopped working with my latest SVN pull to
> numpy.

Which SVN revision? Before or after the Py3K commits?
Note that the trunk is currently aiming at 1.5.x, code for 1.4.x is in a
branch.

> * 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()

Probably due to the PEP 3118 buffer interface implementation? I'll try
to see what's wrong here.

> * 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?

Again, sounds like the buffer interface.

> 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.

Well, there's still a lot of time to fix these issues before 1.5.0 is
out. Just file bug tickets for each one :)

-- 
Pauli Virtanen





More information about the NumPy-Discussion mailing list