Skip to content

Commit

Permalink
Fixed object put bug..
Browse files Browse the repository at this point in the history
  • Loading branch information
teoliphant committed Oct 5, 2005
1 parent b4a71a6 commit 77ec6f0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ include MANIFEST.in
#recursive-include scipy/f2py2e/tests/mixed *.f *.f90
##recursive-include scipy/f2py2e/doc *.py *.txt *.tex *.html Makefile
#recursive-include scipy/f2py2e/docs *.txt *.html *.dat *.f *.f90 *.pyf setup_example.py f2py_style.css
include scipy/corelib/blasdot/cblas.h
recursive-include scipy/corelib/mtrand *.c *.h *.pyx *.pxi
prune scipy/base/include/scipy
recursive-include scipy/base/include/scipy *object.h
recursive-include scipy/base/include/scipy *object.h
10 changes: 7 additions & 3 deletions scipy/base/src/arrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions scipy/base/src/arraytypes.inc.src
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,7 @@ PyArray_DescrFromType(int type) {
return userdescrs[type-PyArray_USERDEF];
}
else {
fprintf(stderr, "Getting Descr from character code...\n");
switch(type) {
case PyArray_INTPLTR: return descrs[PyArray_INTP];
case PyArray_DOUBLELTR: return descrs[PyArray_DOUBLE];
Expand Down
7 changes: 4 additions & 3 deletions scipy/base/src/multiarraymodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2261,14 +2261,15 @@ PyArray_Put(PyArrayObject *self, PyObject *indices0, PyObject* values0)
if (indices == NULL) goto fail;
ni = PyArray_SIZE(indices);

values = (PyArrayObject *)PyArray_ContiguousFromObject(values0,
self->descr->type, 0, 0);
values = (PyArrayObject *)\
PyArray_ContiguousFromObject(values0, self->descr->type_num,
0, 0);
if (values == NULL) goto fail;
nv = PyArray_SIZE(values);
if (nv > 0) { /* nv == 0 for a null array */
for(i=0; i<ni; i++) {
src = values->data + chunk * (i % nv);
tmp = ((long *)(indices->data))[i];
tmp = ((intp *)(indices->data))[i];
if (tmp < 0) tmp = tmp+max_item;
if ((tmp < 0) || (tmp >= max_item)) {
PyErr_SetString(PyExc_IndexError, "Index out of range for array");
Expand Down
4 changes: 2 additions & 2 deletions scipy/base/src/ufuncobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ PyUFunc_GenericFunction(PyUFuncObject *self, PyObject *args,
/* Everything is notswapped, aligned and of the
right type but not contiguous. -- Almost as fast.
*/
fprintf(stderr, "NOBUFFER...%d\n", loop->size);
/* fprintf(stderr, "NOBUFFER...%d\n", loop->size);*/
while (loop->index < loop->size) {
for (i=0; i<self->nargs; i++)
loop->bufptr[i] = loop->iters[i]->dataptr;
Expand Down Expand Up @@ -1282,7 +1282,7 @@ PyUFunc_GenericFunction(PyUFuncObject *self, PyObject *args,
d. copy output buffer back to output arrays.
3. goto next position
*/
fprintf(stderr, "BUFFER...%d\n", loop->size);
/* fprintf(stderr, "BUFFER...%d\n", loop->size);*/
while (index < size) {
/*copy input data */
for (i=0; i<self->nin; i++) {
Expand Down

0 comments on commit 77ec6f0

Please sign in to comment.