Basically, bool(NotImplemented) == True, which means that you have to check for 'result == Py_NotImplemented' before you check PyObject_IsTrue(). Going further, though, I simplified the _is_equal a lot by switching to using object definitions (rather than PyObject *). This now handles exceptions and refcounts properly, and the code is cleaner to boot. (Exceptions will now include these lines in the traceback, etc.)