diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-10-22 20:23:25 +0200 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2013-10-22 20:26:59 +0200 |
commit | b52487e026fc25e913b226381b185133ea629fc6 (patch) | |
tree | 1304dc8b1d5956c90682337cf00a2cb6bd3448ba /numpy/core | |
parent | 54d3559c325be26f8fee71e1c669cc502286dc77 (diff) | |
download | numpy-b52487e026fc25e913b226381b185133ea629fc6.tar.gz |
BUG: fix crash on default errobj
Missing check for optional NULL argument, the case can only happen if
the error mask is 0 (the old default).
closes gh-3962
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/umath/ufunc_object.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index e419a6611..38091d5ff 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -432,10 +432,17 @@ _extract_pyvals(PyObject *ref, char *name, int *bufsize, { PyObject *retval; + /* default errobj case, skips dictionary lookup */ if (ref == NULL) { - *errmask = UFUNC_ERR_DEFAULT; - *errobj = Py_BuildValue("NO", PyBytes_FromString(name), Py_None); - *bufsize = NPY_BUFSIZE; + if (errmask) { + *errmask = UFUNC_ERR_DEFAULT; + } + if (errobj) { + *errobj = Py_BuildValue("NO", PyBytes_FromString(name), Py_None); + } + if (bufsize) { + *bufsize = NPY_BUFSIZE; + } return 0; } |