Commit 1186883d authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix list compare order

(a == b) != (b == a)
parent 7c562fab
......@@ -1013,7 +1013,7 @@ static inline int listContainsShared(BoxedList* self, Box* elt) {
if (identity_eq)
return true;
int r = PyObject_RichCompareBool(e, elt, Py_EQ);
int r = PyObject_RichCompareBool(elt, e, Py_EQ);
if (r == -1)
throwCAPIException();
......
class A(object):
def __eq__(self, rhs):
return True
class B(object):
def __eq__(self, lhs):
return False
print A() == B()
print B() == A()
print A() in [B()]
print B() in [A()]
print A() in (B(),)
print B() in (A(),)
print A() in {B(): 1}
print B() in {A(): 1}
print A() in {B()}
print B() in {A()}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment