See #6236 (comment). Since our oldest supported Python version is 2.6, there is no longer a need for separate compilation paths for Python 2.x and 3.x, for Python object comparison, since both provide PyObject_RichCompareBool. It may also be a good idea to get rid of the Pyobject_Cmp function, defined for Python 3.x in npy_3kcompat.h, which was recently discovered to be broken by @pv, see #6229 (comment).
I'll try to put a PR together for this shortly, unless someone else wants the glory for themselves.