Array Indexing by int64 appears to be broken

Issue #50 resolved
Samuel Reid Coolidge created an issue

While doing some operations with numpypy I came across an apparent bug that I was able to distill to this fundamental issue. I expected the result of this code to be just 2 rather than an array containing 2. The result of running this code on a different computer in both Python 2.7.10 and PyPy Version 4.0.1 is the integer 2; however, running in PyPy 5.0.0 gives the result shown below.

>>>> import _numpypy
>>>> a = _numpypy.multiarray.array([1,2], dtype = 'int64')
>>>> b = _numpypy.multiarray.array([1,2])
>>>> b[a[0]]
array([2])

Comments (3)

  1. mattip

    Note that the return value is should be a numpy scalar, not an int (you stated that the result is the integer 2, which is not strictly correct). This was fixed in the fix_indexing_by_numpy_int branch, which was merged after the release of PyPy 5.0.0, please update to any PyPy 5.0.1 and later to get the fixed behaviour

  2. Log in to comment