mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
fix dict.__init__
This commit is contained in:
parent
9ea1fbb9ba
commit
99195ac490
@ -1283,13 +1283,14 @@ void init_builtins(VM* _vm) {
|
|||||||
for(PyObject* item : list){
|
for(PyObject* item : list){
|
||||||
Tuple& t = CAST(Tuple&, item);
|
Tuple& t = CAST(Tuple&, item);
|
||||||
if(t.size() != 2){
|
if(t.size() != 2){
|
||||||
vm->ValueError("dict() takes an iterable of tuples (key, value)");
|
vm->ValueError("dict() takes a list of tuples (key, value)");
|
||||||
return vm->None;
|
return vm->None;
|
||||||
}
|
}
|
||||||
self.set(t[0], t[1]);
|
self.set(t[0], t[1]);
|
||||||
}
|
}
|
||||||
|
return vm->None;
|
||||||
}
|
}
|
||||||
return vm->None;
|
vm->TypeError("dict() takes a dictionary or a list of tuples");
|
||||||
}
|
}
|
||||||
vm->TypeError("dict() takes at most 1 argument");
|
vm->TypeError("dict() takes at most 1 argument");
|
||||||
PK_UNREACHABLE()
|
PK_UNREACHABLE()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user