numpy/numpy — pull request #331 by ericsuh (2012-07-05 20:11:59+00:00)
Title: Fixed bug in numpy.piecewise() for 0-d array handling

Updated numpy/lib/function_base.py to fix bug in numpy.piecewise() for 0-d array handling and boolean indexing with scalars.

Bug test case:

>>> numpy.piecewise(5, [True, False], [1, 0])
Traceback (most recent call last):
[...]
y[condlist[k]] = item
ValueError: boolean index array has too many values

After fix:

>>> numpy.piecewise(5, [True, False], [1, 0])
array(1)