From 1473800aeb30256517a11556fa1ad86c9127d641 Mon Sep 17 00:00:00 2001 From: David Cournapeau Date: Tue, 2 Feb 2010 04:54:53 +0000 Subject: BUG: fix #1387. Raise ValueError for empty input to bincount. --- numpy/lib/src/_compiled_base.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'numpy/lib/src') diff --git a/numpy/lib/src/_compiled_base.c b/numpy/lib/src/_compiled_base.c index e272e835a..38a446c06 100644 --- a/numpy/lib/src/_compiled_base.c +++ b/numpy/lib/src/_compiled_base.c @@ -117,6 +117,11 @@ arr_bincount(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwds) goto fail; } len = PyArray_SIZE(lst); + if (len < 1) { + PyErr_SetString(PyExc_ValueError, + "The first argument cannot be empty."); + goto fail; + } numbers = (intp *) PyArray_DATA(lst); mxi = mxx(numbers, len); mni = mnx(numbers, len); -- cgit v1.2.1