Skip to content

Commit

Permalink
Fix segfault on indexing (but functionality still not working). Add v…
Browse files Browse the repository at this point in the history
…ectorize test-case (ticket numpy#52).  Improve comments on broadcast failure.
  • Loading branch information
teoliphant committed Apr 13, 2006
1 parent 6eec6fa commit 9640396
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
5 changes: 3 additions & 2 deletions THANKS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Chris Hanley for help with records.py, testing, and bug fixes.
Travis Vaught and Joe Cooper for administration of numpy.org web site and SVN
Eric Firing for bugfixes.
Arnd Baecker for 64-bit testing
David Cooke for many code improvements including the auto-generated C-API
David Cooke for many code improvements including the auto-generated C-API, and optimizations.
Alexander Belopolsky (Sasha) for Masked array bug-fixes and tests and rank-0 array improvements and other code additions
Francesc Altet for unicode and nested record tests and help with nested records
Tim Hochberg for getting the build working on MSVC
Tim Hochberg for getting the build working on MSVC, optimization improvements, and code review
Charles Harris for the sorting code originally written for Numarray.
8 changes: 5 additions & 3 deletions numpy/core/src/arrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1777,8 +1777,10 @@ PyArray_SetMap(PyArrayMapIterObject *mit, PyObject *op)
if ((mit->subspace != NULL) && (mit->consec)) {
if (mit->iteraxes[0] > 0) { /* then we need to swap */
_swap_axes(mit, (PyArrayObject **)&arr);
if (arr == NULL) return -1;
}
}


if ((it = (PyArrayIterObject *)PyArray_IterNew(arr))==NULL) {
Py_DECREF(arr);
Expand Down Expand Up @@ -7522,9 +7524,9 @@ PyArray_Broadcast(PyArrayMultiIterObject *mit)
mit->dimensions[i] = tmp;
else if (mit->dimensions[i] != tmp) {
PyErr_SetString(PyExc_ValueError,
"index objects are " \
"not broadcastable " \
"to a single shape");
"shape mismatch: objects" \
" cannot be broadcast" \
" to a single shape");
return -1;
}
}
Expand Down
7 changes: 6 additions & 1 deletion numpy/lib/tests/test_function_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,12 @@ def check_simple(self):
(a,b)=histogram(linspace(0,10,100))
assert(all(a==10))


class test_vectorize( ScipyTestCase ):
def check_vectorize( self ):
x = linspace(-3,2,10000)
f = vectorize(lambda x: x)
y = f(x)
assert_array_equal(y, x)



Expand Down

0 comments on commit 9640396

Please sign in to comment.