Commit e03daee3 authored by Kevin Modzelewski's avatar Kevin Modzelewski Committed by Kevin Modzelewski

Misc compatibility fixes

parent ad8d03c3
......@@ -786,7 +786,8 @@ Box* listIAdd(BoxedList* self, Box* _rhs) {
}
Box* listAdd(BoxedList* self, Box* _rhs) {
if (_rhs->cls != list_cls) {
if (!PyList_Check(_rhs)) {
return NotImplemented;
raiseExcHelper(TypeError, "can only concatenate list (not \"%s\") to list", getTypeName(_rhs));
}
......
......@@ -3864,6 +3864,7 @@ void setupRuntime() {
none_cls->giveAttr("__repr__", new BoxedFunction(boxRTFunction((void*)noneRepr, STR, 1)));
none_cls->giveAttr("__nonzero__", new BoxedFunction(boxRTFunction((void*)noneNonzero, BOXED_BOOL, 1)));
none_cls->giveAttr("__doc__", None);
none_cls->tp_hash = (hashfunc)_Py_HashPointer;
none_cls->freeze();
......
......@@ -39,6 +39,8 @@ print MyList((1,2,3)) <= MyList((1,2,3))
print type(MyList((1, 2, 3)) * 1)
print [1] + MyList([3])
class ListWithInit(list):
def __init__(self, *args, **kwargs):
print "ListWithInit.__init__", args, kwargs
......
print None.__class__
print type(None).__doc__, None.__doc__
......@@ -18,3 +18,7 @@ try:
except TypeError as e:
print e
print "" + D()
# This also applies to list:
print [] + D()
......@@ -7,3 +7,8 @@ try:
print "".__add__(1)
except TypeError as e:
print e
try:
print [].__add__(1)
except TypeError as e:
print e
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