thouis / numpy-trac-migration

numpy Trac to github issues migration
2 stars 3 forks source link

python3: regression for unique on dtype=object arrays with varying items types (Trac #2188) #5978

Open numpy-gitbot opened 11 years ago

numpy-gitbot commented 11 years ago

Original ticket http://projects.scipy.org/numpy/ticket/2188 on 2012-07-23 by atmention:yarikoptic, assigned to unknown.

tested against current master (present in 1.6.2 as well):

If with python2.x series it works ok, without puking:

$> python2.7 -c 'import numpy as np; print repr(repr(np.unique(np.array([1,2, None, "str"]))))' 
'array([None, 1, 2, str], dtype=object)'

NB I will report a bug on repr here separately if not yet filed

it fails with python3.x altogether:

$> python3.2 -c 'import numpy as np; print(repr(repr(np.unique(np.array([1,2,None, "str"])))))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.2/dist-packages/numpy/lib/arraysetops.py", line 194, in unique
    ar.sort()
TypeError: unorderable types: int() > NoneType()

whenever IMHO it must operate correctly -- semantic of unique() action should not imply ability to sort the elements