Fix __richcmp__ bug that's been failing Sage tests.