Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
LIBLOC_PRIVATE {
global:
# AS
LIBLOC_PRIVATE {
global:
# AS
loc_as_get_name;
loc_as_get_number;
loc_as_new;
loc_as_get_name;
loc_as_get_number;
loc_as_new;
return PyUnicode_FromString(name);
}
return PyUnicode_FromString(name);
}
+static PyObject* AS_richcompare(ASObject* self, ASObject* other, int op) {
+ int r = loc_as_cmp(self->as, other->as);
+
+ switch (op) {
+ case Py_EQ:
+ if (r == 0)
+ Py_RETURN_TRUE;
+
+ Py_RETURN_FALSE;
+
+ case Py_LT:
+ if (r < 0)
+ Py_RETURN_TRUE;
+
+ Py_RETURN_FALSE;
+
+ default:
+ break;
+ }
+
+ Py_RETURN_NOTIMPLEMENTED;
+}
+
static struct PyGetSetDef AS_getsetters[] = {
{
"name",
static struct PyGetSetDef AS_getsetters[] = {
{
"name",
tp_doc: "AS object",
tp_getset: AS_getsetters,
tp_repr: (reprfunc)AS_repr,
tp_doc: "AS object",
tp_getset: AS_getsetters,
tp_repr: (reprfunc)AS_repr,
+ tp_richcompare: (richcmpfunc)AS_richcompare,