summaryrefslogtreecommitdiff
path: root/numpy/core/src/arraymethods.c
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/src/arraymethods.c')
-rw-r--r--numpy/core/src/arraymethods.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/core/src/arraymethods.c b/numpy/core/src/arraymethods.c
index 9c56e6459..57c879426 100644
--- a/numpy/core/src/arraymethods.c
+++ b/numpy/core/src/arraymethods.c
@@ -1646,16 +1646,20 @@ array_trace(PyArrayObject *self, PyObject *args, PyObject *kwds)
static PyObject *
array_clip(PyArrayObject *self, PyObject *args, PyObject *kwds)
{
- PyObject *min, *max;
+ PyObject *min=NULL, *max=NULL;
PyArrayObject *out=NULL;
static char *kwlist[] = {"min", "max", "out", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO|O&", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOO&", kwlist,
&min, &max,
PyArray_OutputConverter,
&out))
return NULL;
+ if (max == NULL && min == NULL) {
+ PyErr_SetString(PyExc_ValueError, "One of max or min must be given.");
+ return NULL;
+ }
return _ARET(PyArray_Clip(self, min, max, out));
}