summaryrefslogtreecommitdiff
path: root/numpy/lib/src/_compiled_base.c
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2010-02-02 04:54:53 +0000
committerDavid Cournapeau <cournape@gmail.com>2010-02-02 04:54:53 +0000
commit1473800aeb30256517a11556fa1ad86c9127d641 (patch)
treec43be7784cb14fcb34b0baf1ba65fc8a4360b85e /numpy/lib/src/_compiled_base.c
parent60e53321fbb0a5e3ae630100eff32aec939a4434 (diff)
downloadnumpy-1473800aeb30256517a11556fa1ad86c9127d641.tar.gz
BUG: fix #1387. Raise ValueError for empty input to bincount.
Diffstat (limited to 'numpy/lib/src/_compiled_base.c')
-rw-r--r--numpy/lib/src/_compiled_base.c5
1 files changed, 5 insertions, 0 deletions
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);