s4/ndr/py_security: remove python 2 ifdefs
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 31 Jan 2023 23:55:18 +0000 (12:55 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 3 Feb 2023 02:27:32 +0000 (02:27 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/librpc/ndr/py_security.c

index ff3de775af6d289fe6fef18633653912172e54ea..c5c1620acdb308e8dddf1bd9d6d5a67b01fcc932 100644 (file)
@@ -68,7 +68,6 @@ static PyObject *py_dom_sid_split(PyObject *py_self, PyObject *args)
        return Py_BuildValue("(OI)", py_domain_sid, rid);
 }
 
-#if PY_MAJOR_VERSION >= 3
 static PyObject *py_dom_sid_richcmp(PyObject *py_self, PyObject *py_other, int op)
 {
        struct dom_sid *self = pytalloc_get_ptr(py_self), *other;
@@ -93,25 +92,6 @@ static PyObject *py_dom_sid_richcmp(PyObject *py_self, PyObject *py_other, int o
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
 }
-#else
-static int py_dom_sid_cmp(PyObject *py_self, PyObject *py_other)
-{
-       struct dom_sid *self = pytalloc_get_ptr(py_self), *other;
-       int val;
-
-       other = pytalloc_get_ptr(py_other);
-       if (other == NULL)
-               return -1;
-
-       val =  dom_sid_compare(self, other);
-       if (val > 0) {
-               return 1;
-       } else if (val < 0) {
-               return -1;
-       }
-       return 0;
-}
-#endif
 
 static PyObject *py_dom_sid_str(PyObject *py_self)
 {
@@ -160,11 +140,7 @@ static void py_dom_sid_patch(PyTypeObject *type)
        type->tp_init = py_dom_sid_init;
        type->tp_str = py_dom_sid_str;
        type->tp_repr = py_dom_sid_repr;
-#if PY_MAJOR_VERSION >= 3
        type->tp_richcompare = py_dom_sid_richcmp;
-#else
-       type->tp_compare = py_dom_sid_cmp;
-#endif
        PyType_AddMethods(type, py_dom_sid_extra_methods);
 }