[Numpy-svn] r4210 - in trunk/numpy/core: src tests
numpy-svn at scipy.org
numpy-svn at scipy.org
Wed Oct 17 00:06:32 EDT 2007
Author: oliphant
Date: 2007-10-16 23:06:29 -0500 (Tue, 16 Oct 2007)
New Revision: 4210
Modified:
trunk/numpy/core/src/ufuncobject.c
trunk/numpy/core/tests/test_regression.py
Log:
Fix ticket #592: segfault with bitwise_or inplace
Modified: trunk/numpy/core/src/ufuncobject.c
===================================================================
--- trunk/numpy/core/src/ufuncobject.c 2007-10-16 09:46:43 UTC (rev 4209)
+++ trunk/numpy/core/src/ufuncobject.c 2007-10-17 04:06:29 UTC (rev 4210)
@@ -1344,7 +1344,8 @@
loop->meth = BUFFER_UFUNCLOOP;
loop->needbuffer[i] = 1;
}
- if (!loop->obj && mps[i]->descr->type_num == PyArray_OBJECT) {
+ if (!loop->obj && ((mps[i]->descr->type_num == PyArray_OBJECT) ||
+ (arg_types[i] == PyArray_OBJECT))) {
loop->obj = 1;
}
}
@@ -1486,7 +1487,7 @@
/* compute the element size */
for (i=0; i<self->nargs;i++) {
- if (!loop->needbuffer) continue;
+ if (!loop->needbuffer[i]) continue;
if (arg_types[i] != mps[i]->descr->type_num) {
descr = PyArray_DescrFromType(arg_types[i]);
if (loop->steps[i])
@@ -1913,6 +1914,7 @@
}
/* cast to the other buffer if necessary */
if (loop->cast[i]) {
+ /* fprintf(stderr, "casting... %d, %p %p\n", i, buffer[i]); */
loop->cast[i](buffer[i],
castbuf[i],
(intp) datasize[i],
@@ -1926,6 +1928,7 @@
for (i=self->nin; i<self->nargs; i++) {
if (!needbuffer[i]) continue;
if (loop->cast[i]) {
+ /* fprintf(stderr, "casting back... %d, %p", i, castbuf[i]); */
loop->cast[i](castbuf[i],
buffer[i],
(intp) datasize[i],
Modified: trunk/numpy/core/tests/test_regression.py
===================================================================
--- trunk/numpy/core/tests/test_regression.py 2007-10-16 09:46:43 UTC (rev 4209)
+++ trunk/numpy/core/tests/test_regression.py 2007-10-17 04:06:29 UTC (rev 4210)
@@ -733,5 +733,12 @@
y2 = y[::-1]
assert_equal(N.dot(x,z),N.dot(x,y2))
+ def check_object_casting(self, level=rlevel):
+ def rs():
+ x = N.ones([484,286])
+ y = N.zeros([484,286])
+ x |= y
+ self.failUnlessRaises(TypeError,rs)
+
if __name__ == "__main__":
NumpyTest().run()
More information about the Numpy-svn
mailing list