[Numpy-discussion] Memory Error in Search Sorted

Tom Denniston tom.denniston at alum.dartmouth.org
Wed May 9 15:53:10 EDT 2007


So searchsorted is supposed to take a list.  The arguments I am using
are not correct.  But it still seems strange to me that these
incorrect params trigger a memory error.  Is a check simply missing or
is this possibly a sign of a larger bug?  I can simply correct my
params so this is no big deal, but I just wanted to report it as it
seemed like a subtle bug.

--Tom


In [2]: numpy.searchsorted(numpy.array(['1', '2', '3', '4']), [1])
Out[2]: array([0])

In [3]: numpy.searchsorted(numpy.array(['1', '2', '3', '4']), 1)
---------------------------------------------------------------------------
<type 'exceptions.MemoryError'>           Traceback (most recent call last)

/code/src/<ipython console> in <module>()

/lib/python2.5/site-packages/numpy/core/fromnumeric.py in
searchsorted(a, v, side)
    378     except AttributeError:
    379         return _wrapit(a, 'searchsorted', v, side)
--> 380     return searchsorted(v, side)
    381
    382 def resize(a, new_shape):

<type 'exceptions.MemoryError'>:



More information about the NumPy-Discussion mailing list