summaryrefslogtreecommitdiff
path: root/numpy/core/src/arrayobject.c
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-07-11 21:50:11 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-07-11 21:50:11 +0000
commitd48cd46c8ee45039735ae49a268c9c8943c34484 (patch)
tree4cb6636785ca6e7fc0a720286d2edf51c34c9ee7 /numpy/core/src/arrayobject.c
parenta345bd21446141f16f70b8f84c7b42b257b0dcff (diff)
downloadnumpy-d48cd46c8ee45039735ae49a268c9c8943c34484.tar.gz
Fix base when using array interface and a buffer object.
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r--numpy/core/src/arrayobject.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index 074d2d7b4..ba24f9ec2 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -7641,6 +7641,7 @@ PyArray_FromInterface(PyObject *input)
PyObject *attr=NULL, *item=NULL;
PyObject *tstr=NULL, *shape=NULL;
PyObject *inter=NULL;
+ PyObject *base=NULL;
PyArrayObject *ret;
PyArray_Descr *type=NULL;
char *data;
@@ -7664,6 +7665,7 @@ PyArray_FromInterface(PyObject *input)
if (tstr == NULL) {Py_DECREF(inter); return Py_NotImplemented;}
attr = PyDict_GetItemString(inter, "data");
+ base = input;
if ((attr == NULL) || (attr==Py_None) || (!PyTuple_Check(attr))) {
if (attr && (attr != Py_None)) item=attr;
else item=input;
@@ -7687,6 +7689,7 @@ PyArray_FromInterface(PyObject *input)
}
data += num;
}
+ base = item;
}
else {
PyObject *dataptr;
@@ -7746,8 +7749,8 @@ PyArray_FromInterface(PyObject *input)
NULL, data,
dataflags, NULL);
if (ret == NULL) return NULL;
- Py_INCREF(input);
- ret->base = input;
+ Py_INCREF(base);
+ ret->base = base;
attr = PyDict_GetItemString(inter, "strides");
if (attr != NULL && attr != Py_None) {