[Numpy-discussion] Changes in PyArray_FromAny between 1.5.x and 1.6.x
Travis Oliphant
travis at continuum.io
Tue Jun 5 00:30:37 EDT 2012
Can you raise an issue on the Github issue tracker for NumPy? These issues will be looked at more closely. This kind of change should not have made it in to the release.
<off-topic>
Given the lack of availability of time from enough experts in NumPy, this is the sort of thing that can happen. I was not able to guide development of NumPy appropriately at my old job. That's a big reason I left. I still have more to do than just guide NumPy now, but making sure NumPy is maintained is a big part of what I am doing and why both NumFOCUS and Continuum Analytics exist. I am very hopeful that we can avoid this sort of regression in the future. More tests will help.
<off-topic>
I think it's important to note that there are many people who will be in the same boat of upgrading to 1.6 over the coming year and there are going to be other little issues like this we will need to address.
-Travis
On Jun 4, 2012, at 4:12 PM, Dag Sverre Seljebotn wrote:
> On 06/04/2012 09:06 PM, Mike Hansen wrote:
>> On Mon, May 28, 2012 at 3:15 AM, Mike Hansen<mhansen at gmail.com> wrote:
>>> In trying to upgrade NumPy within Sage, we notices some differences in
>>> behavior between 1.5 and 1.6. In particular, in 1.5, we have
>>>
>>> sage: f = 0.5
>>> sage: f.__array_interface__
>>> {'typestr': '=f8'}
>>> sage: numpy.array(f)
>>> array(0.5)
>>> sage: numpy.array(float(f))
>>> array(0.5)
>>>
>>> In 1.6, we get the following,
>>>
>>> sage: f = 0.5
>>> sage: f.__array_interface__
>>> {'typestr': '=f8'}
>>> sage: numpy.array(f)
>>> array(0.500000000000000, dtype=object)
>>>
>>> This seems to be do to the changes in PyArray_FromAny introduced in
>>> https://github.com/mwhansen/numpy/commit/2635398db3f26529ce2aaea4028a8118844f3c48
>>> . In particular, _array_find_type used to be used to query our
>>> __array_interface__ attribute, and it no longer seems to work. Is
>>> there a way to get the old behavior with the current code?
>
> No idea. If you want to spend the time to fix this properly, you could
> implement PEP 3118 and use that instead to export your array data (which
> can be done from Cython using __getbuffer__ on a Cython class).
>
> Dag
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
More information about the NumPy-Discussion
mailing list