X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/85bc8b4f2fadf63ead76af4ec6114f78ffd7286f..1810cc513ef47dfad323e078fd419fcee049d9d2:/pyke/pyke.c diff --git a/pyke/pyke.c b/pyke/pyke.c index cef4f82..1d4458b 100644 --- a/pyke/pyke.c +++ b/pyke/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,