Commit f469e402 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #490 from toshok/list-ne-eq-subclasses

list __eq__ and __ne__ work for rhs's that are list subclasses
parents 3d9ead49 52098491
......@@ -941,7 +941,7 @@ Box* _listCmp(BoxedList* lhs, BoxedList* rhs, AST_TYPE::AST_TYPE op_type) {
}
Box* listEq(BoxedList* self, Box* rhs) {
if (rhs->cls != list_cls) {
if (!isSubclass(rhs->cls, list_cls)) {
return NotImplemented;
}
......@@ -951,7 +951,7 @@ Box* listEq(BoxedList* self, Box* rhs) {
}
Box* listNe(BoxedList* self, Box* rhs) {
if (rhs->cls != list_cls) {
if (!isSubclass(rhs->cls, list_cls)) {
return NotImplemented;
}
......
......@@ -12,3 +12,6 @@ print l
print len(MyList.__new__(MyList))
l[:] = l[:]
print l
print [1,2,3] == MyList((1,2,3))
print [1,2,3] != MyList((1,2,3))
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