[pypy-issue] Issue #2046: Incorrect in-place sort behavior in numpy array slice (pypy/pypy)

Ed Baskerville issues-reply at bitbucket.org
Tue May 12 22:13:34 CEST 2015


New issue 2046: Incorrect in-place sort behavior in numpy array slice
https://bitbucket.org/pypy/pypy/issue/2046/incorrect-in-place-sort-behavior-in-numpy

Ed Baskerville:

In PyPy 2.5.1, OS X binary build, PyPy's numpy fork, sorting a column slice of a 2D numpy array can result in incorrect behavior. In this case, the mistaken modifications are not restricted to the column being sorted:

```{python}
>>>> import numpy
>>>> x = numpy.array([[2,0],[1,0]])
>>>> x
array([[2, 0],
       [1, 0]])
>>>> x[0,:].sort()
>>>> x
array([[0, 2],
       [1, 0]])
```

The behavior should be (as generated using Python 2.7.9/Anaconda 2.0.1):
```{python}
>>> import numpy
>>> x = numpy.array([[2,0],[1,0]])
>>> x
array([[2, 0],
       [1, 0]])
>>> x[:,0].sort()
>>> x
array([[1, 0],
       [2, 0]])
```




More information about the pypy-issue mailing list