Commit bf1a4973 authored by Chris Toshok's avatar Chris Toshok

fix the remaining subclass checks for list comparisons <, <=, >, >=

parent 27e24f67
...@@ -961,7 +961,7 @@ Box* listNe(BoxedList* self, Box* rhs) { ...@@ -961,7 +961,7 @@ Box* listNe(BoxedList* self, Box* rhs) {
} }
Box* listLt(BoxedList* self, Box* rhs) { Box* listLt(BoxedList* self, Box* rhs) {
if (rhs->cls != list_cls) { if (!isSubclass(rhs->cls, list_cls)) {
return NotImplemented; return NotImplemented;
} }
...@@ -971,7 +971,7 @@ Box* listLt(BoxedList* self, Box* rhs) { ...@@ -971,7 +971,7 @@ Box* listLt(BoxedList* self, Box* rhs) {
} }
Box* listLe(BoxedList* self, Box* rhs) { Box* listLe(BoxedList* self, Box* rhs) {
if (rhs->cls != list_cls) { if (!isSubclass(rhs->cls, list_cls)) {
return NotImplemented; return NotImplemented;
} }
...@@ -981,7 +981,7 @@ Box* listLe(BoxedList* self, Box* rhs) { ...@@ -981,7 +981,7 @@ Box* listLe(BoxedList* self, Box* rhs) {
} }
Box* listGt(BoxedList* self, Box* rhs) { Box* listGt(BoxedList* self, Box* rhs) {
if (rhs->cls != list_cls) { if (!isSubclass(rhs->cls, list_cls)) {
return NotImplemented; return NotImplemented;
} }
...@@ -991,7 +991,7 @@ Box* listGt(BoxedList* self, Box* rhs) { ...@@ -991,7 +991,7 @@ Box* listGt(BoxedList* self, Box* rhs) {
} }
Box* listGe(BoxedList* self, Box* rhs) { Box* listGe(BoxedList* self, Box* rhs) {
if (rhs->cls != list_cls) { if (!isSubclass(rhs->cls, list_cls)) {
return NotImplemented; return NotImplemented;
} }
......
...@@ -13,5 +13,26 @@ print len(MyList.__new__(MyList)) ...@@ -13,5 +13,26 @@ print len(MyList.__new__(MyList))
l[:] = l[:] l[:] = l[:]
print l print l
print [1,2,3] == MyList((1,2,3)) print [1,2,3] == MyList((1,2,3,4))
print [1,2,3] != MyList((1,2,3)) print [1,2,3] != MyList((1,2,3,4))
print [1,2,3,4] > MyList((1,2,3))
print [1,2,3,4] < MyList((1,2,3))
print [1,2,3] > MyList((1,2,3,4))
print [1,2,3] < MyList((1,2,3,4))
print [1,2,3] >= MyList((1,2,3))
print [1,2,3] <= MyList((1,2,3))
print MyList((1,2,3)) == MyList((1,2,3,4))
print MyList((1,2,3)) != MyList((1,2,3,4))
print MyList((1,2,3,4)) > MyList((1,2,3))
print MyList((1,2,3,4)) < MyList((1,2,3))
print MyList((1,2,3)) > MyList((1,2,3,4))
print MyList((1,2,3)) < MyList((1,2,3,4))
print MyList((1,2,3)) >= MyList((1,2,3))
print MyList((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