summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2009-12-06 12:19:24 +0000
committerPauli Virtanen <pav@iki.fi>2009-12-06 12:19:24 +0000
commitb5a0fa01112665fec8e165d5bbdc32bbdd2f1602 (patch)
tree8b1ddfb983952dc665c5f949eaa4ac3118e25c88
parentfe75577497ea91dfd5a8e3ce9c7e9544318ad11d (diff)
downloadnumpy-b5a0fa01112665fec8e165d5bbdc32bbdd2f1602.tar.gz
3K: core: make comparison between Unicode and Bytes NotImplemented, as it is in Py3K
-rw-r--r--numpy/core/src/multiarray/arrayobject.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/arrayobject.c b/numpy/core/src/multiarray/arrayobject.c
index e1c8925a4..4572108b4 100644
--- a/numpy/core/src/multiarray/arrayobject.c
+++ b/numpy/core/src/multiarray/arrayobject.c
@@ -719,6 +719,15 @@ _strings_richcompare(PyArrayObject *self, PyArrayObject *other, int cmp_op,
/* Cast arrays to a common type */
if (self->descr->type_num != other->descr->type_num) {
+#if defined(NPY_PY3K)
+ /*
+ * Comparison between Bytes and Unicode is not defined in Py3K;
+ * we follow.
+ */
+ result = Py_NotImplemented;
+ Py_INCREF(result);
+ return result;
+#else
PyObject *new;
if (self->descr->type_num == PyArray_STRING &&
other->descr->type_num == PyArray_UNICODE) {
@@ -750,6 +759,7 @@ _strings_richcompare(PyArrayObject *self, PyArrayObject *other, int cmp_op,
"in comparison");
return NULL;
}
+#endif
}
else {
Py_INCREF(self);