thouis / numpy-trac-migration

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

PySequence_Check should return 0 for 0-d arrays (Trac #2199) #5989

Open numpy-gitbot opened 12 years ago

numpy-gitbot commented 12 years ago

Original ticket http://projects.scipy.org/numpy/ticket/2199 on 2012-08-09 by trac user batavus, assigned to unknown.

0-d arrays are not iterable:

list(numpy.array(1)) Traceback (most recent call last): File "", line 1, in TypeError: iteration over a 0-d array

Consequently, they do not provide the sequence protocol: PySequence_Length and PySequence_GetItem fail when called for a 0-d array.

However, PySequence_Check returns 1. It should return 0.