mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
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:
parent
673f7efa08
commit
ab078ddb4f
3 changed files with 23 additions and 1 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue