Commit 9dec82ed authored by Marius Wachtler's avatar Marius Wachtler

list.extend returns None

parent ccf53aab
......@@ -783,6 +783,11 @@ Box* listIAdd(BoxedList* self, Box* _rhs) {
return self;
}
Box* listExtend(BoxedList* self, Box* _rhs) {
listIAdd(self, _rhs);
return None;
}
Box* listAdd(BoxedList* self, Box* _rhs) {
if (!PyList_Check(_rhs)) {
return NotImplemented;
......@@ -1344,7 +1349,7 @@ void setupList() {
new BoxedFunction(FunctionMetadata::create((void*)listPop, UNKNOWN, 2, false, false), { None }));
list_cls->giveAttr("append", new BoxedFunction(FunctionMetadata::create((void*)listAppend, NONE, 2)));
list_cls->giveAttr("extend", new BoxedFunction(FunctionMetadata::create((void*)listIAdd, UNKNOWN, 2)));
list_cls->giveAttr("extend", new BoxedFunction(FunctionMetadata::create((void*)listExtend, NONE, 2)));
list_cls->giveAttr("insert", new BoxedFunction(FunctionMetadata::create((void*)listInsert, NONE, 3)));
list_cls->giveAttr("__mul__", new BoxedFunction(FunctionMetadata::create((void*)listMul, UNKNOWN, 2)));
......
......@@ -85,7 +85,7 @@ while l:
del l[0]
l = range(5)
l.extend(range(5))
print l.extend(range(5))
print l
# Repeating a list
......
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