diff options
author | Mark Wiebe <mwiebe@enthought.com> | 2011-07-19 11:39:46 -0500 |
---|---|---|
committer | Mark Wiebe <mwiebe@enthought.com> | 2011-07-19 14:00:29 -0500 |
commit | 5771857a78dc140dd6a70b007cb0ea2d8ebff77a (patch) | |
tree | a13665de79a447c3a5e41234a1a4032aaa0caecf /numpy/core | |
parent | f8ff0e326c08e42fc9cb230b56079d05bd1059bc (diff) | |
download | numpy-5771857a78dc140dd6a70b007cb0ea2d8ebff77a.tar.gz |
BUG: core: PyArray_GetArrayParamsFromObject was treating __array_interface__ incorrectly
I'm not sure why this came up after the arrayobject field access
changes, since it looks like the bug was in there before already.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/multiarray/ctors.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c index 50a4387bf..9397221a7 100644 --- a/numpy/core/src/multiarray/ctors.c +++ b/numpy/core/src/multiarray/ctors.c @@ -1595,10 +1595,16 @@ PyArray_GetArrayParamsFromObject(PyObject *op, /* If op supports the __array_struct__ or __array_interface__ interface */ tmp = PyArray_FromStructInterface(op); + if (tmp == NULL) { + return -1; + } if (tmp == Py_NotImplemented) { tmp = PyArray_FromInterface(op); + if (tmp == NULL) { + return -1; + } } - else { + if (tmp != Py_NotImplemented) { if (writeable && !PyArray_ISWRITEABLE((PyArrayObject *)tmp)) { PyErr_SetString(PyExc_RuntimeError, "cannot write to array interface object"); |