mp.c, catacomb/__init__.py, pyke/: Fix mixed-mode arithmetic involving `float'.
[pyke] / pyke.c
diff --git a/pyke.c b/pyke.c
index cef4f82..1d4458b 100644 (file)
--- a/pyke.c
+++ b/pyke.c
@@ -128,6 +128,22 @@ PyObject *abstract_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
   return (0);
 }
 
+PyObject *enrich_compare(int op, int cmp)
+{
+  int r = -1;
+
+  switch (op) {
+    case Py_LT: r = cmp <  0; break;
+    case Py_LE: r = cmp <= 0; break;
+    case Py_EQ: r = cmp == 0; break;
+    case Py_NE: r = cmp != 0; break;
+    case Py_GE: r = cmp >= 0; break;
+    case Py_GT: r = cmp >  0; break;
+    default: assert(0);
+  }
+  return (getbool(r));
+}
+
 /*----- Saving and restoring exceptions ----------------------------------*/
 
 void report_lost_exception_v(struct excinfo *exc,