diff options
author | Travis Oliphant <oliphant@enthought.com> | 2005-10-05 07:07:39 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2005-10-05 07:07:39 +0000 |
commit | 77ec6f047995d7a473523feb4fc2a93b537d51c3 (patch) | |
tree | e0e86e5c4a90b249f82fc5196e9a26af9a0e23df /scipy/base/src/arrayobject.c | |
parent | b4a71a6b8025fd4822a49166e051fc16563fc54d (diff) | |
download | numpy-77ec6f047995d7a473523feb4fc2a93b537d51c3.tar.gz |
Fixed object put bug..
Diffstat (limited to 'scipy/base/src/arrayobject.c')
-rw-r--r-- | scipy/base/src/arrayobject.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scipy/base/src/arrayobject.c b/scipy/base/src/arrayobject.c index 55485288e..4f52c276a 100644 --- a/scipy/base/src/arrayobject.c +++ b/scipy/base/src/arrayobject.c @@ -3220,8 +3220,11 @@ PyArray_New(PyTypeObject *subtype, int nd, intp *dims, int type_num, self->flags |= OWN_DATA; /* It is bad to have unitialized OBJECT pointers */ - if (type_num == PyArray_OBJECT) { - memset(data, '\0', sd); + /* We shouldn't need to check for the OBJECT Letter + but perhaps it's best. */ + if (type_num == PyArray_OBJECT || \ + type_num == PyArray_OBJECTLTR) { + memset(data, 0, sd); } } else { @@ -4582,7 +4585,7 @@ Assign_Array(PyArrayObject *self, PyObject *v) { e=PySequence_GetItem(v,l); if (e == NULL) return -1; - r = PySequence_SetItem((PyObject*)self,l,e); + r = PySequence_SetItem((PyObject*)self,l,e); Py_DECREF(e); if(r == -1) return -1; } @@ -4667,6 +4670,7 @@ Array_FromSequence(PyObject *s, PyArray_Typecode *typecode, int min_depth, type, NULL, NULL, itemsize, typecode->fortran, NULL); + PyDimMem_FREE(d); if(!r) return NULL; if(Assign_Array(r,s) == -1) { |