Issue #1393: object_richcompare() returns NotImplemented instead of

False if the objects aren't equal, to give the other side a chance.
This commit is contained in:
Guido van Rossum 2008-01-06 00:09:11 +00:00
parent 673f7efa08
commit ab078ddb4f
3 changed files with 23 additions and 1 deletions

View file

@ -2484,7 +2484,10 @@ object_richcompare(PyObject *self, PyObject *other, int op)
switch (op) {
case Py_EQ:
res = (self == other) ? Py_True : Py_False;
/* Return NotImplemented instead of False, so if two
objects are compared, both get a chance at the
comparison. See issue #1393. */
res = (self == other) ? Py_True : Py_NotImplemented;
Py_INCREF(res);
break;