[Numpy-svn] r2852 - trunk/numpy/core/src
numpy-svn at scipy.org
numpy-svn at scipy.org
Wed Jul 19 21:58:42 EDT 2006
Author: oliphant
Date: 2006-07-19 20:58:39 -0500 (Wed, 19 Jul 2006)
New Revision: 2852
Modified:
trunk/numpy/core/src/arrayobject.c
Log:
Fix ticket #192
Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c 2006-07-19 23:50:23 UTC (rev 2851)
+++ trunk/numpy/core/src/arrayobject.c 2006-07-20 01:58:39 UTC (rev 2852)
@@ -4293,6 +4293,9 @@
memory at each location directly (using string-code).
*/
+static PyObject *array_richcompare(PyArrayObject *, PyObject *, int);
+
+
static PyObject *
_void_compare(PyArrayObject *self, PyArrayObject *other, int cmp_op)
{
@@ -4304,16 +4307,15 @@
if (PyArray_HASFIELDS(self)) {
PyObject *res=NULL, *temp, *a, *b;
PyObject *key, *value, *temp2;
- PyObject *op, *op2;
+ PyObject *op;
int pos=0;
- op = (cmp_op == Py_EQ ? n_ops.equal : n_ops.not_equal);
- op2 = (cmp_op == Py_EQ ? n_ops.logical_and : n_ops.logical_or);
+ op = (cmp_op == Py_EQ ? n_ops.logical_and : n_ops.logical_or);
while (PyDict_Next(self->descr->fields, &pos, &key, &value)) {
- a = array_subscript(self, key);
+ a = PyArray_EnsureAnyArray(array_subscript(self, key));
if (a==NULL) {Py_XDECREF(res); return NULL;}
b = array_subscript(other, key);
if (b==NULL) {Py_XDECREF(res); Py_DECREF(a); return NULL;}
- temp = PyObject_CallFunction(op, "OO", a, b);
+ temp = array_richcompare((PyArrayObject *)a,b,cmp_op);
Py_DECREF(a);
Py_DECREF(b);
if (temp == NULL) {Py_XDECREF(res); return NULL;}
@@ -4321,7 +4323,7 @@
res = temp;
}
else {
- temp2 = PyObject_CallFunction(op2, "OO", res, temp);
+ temp2 = PyObject_CallFunction(op, "OO", res, temp);
Py_DECREF(temp);
Py_DECREF(res);
if (temp2 == NULL) return NULL;
More information about the Numpy-svn
mailing list