numpy/numpy — pull request #2787 by bfroehle (2012-12-04 18:53:57+00:00)
Title: np.unique: TypeError: requested sort not available for type

Upon recently upgrading from 1.6.1 to 1.6.2, I discovered that the well-intentioned 74b9f5ee introduced a regression in `np.unqiue`:

```
>>> import numpy as np
>>> np.__version__
'1.6.2'
>>>
>>> def unique_rows(A):
... A = np.ascontiguousarray(A)
... assert A.ndim == 2
... B, I, J = np.unique(A.view([('', A.dtype)]*A.shape[1]), True, True)
... return B.view(A.dtype).reshape((-1, A.shape[1]), order='C'), I, J
...
>>> A = np.array([[1, 2], [1, 3], [1, 2]], dtype='i')
>>>
>>> unique_rows(A)
Traceback (most recent call last):
File "", line 1, in
File "", line 4, in unique_rows
File "/usr/lib/python2.7/dist-packages/numpy/lib/arraysetops.py", line 178, in unique
perm = ar.argsort(kind='mergesort')
TypeError: requested sort not available for type
```

I filed a bug report against this yesterday (gh-2785) where I learned it was a known issue and has been fixed in 1.7.x.

While I realize a 1.6.3 release is unlikely, there's no harm in reverting this in the `maintenance/1.6.x` branch. I've attached a pull request which does just that, and adds a regression test.

Of course this should _NOT_ be committed to 1.7.x or master, although the regression test could be cherry-picked onto that branch.