blueloveTH 2023-03-13 19:28:45 +08:00
parent a33360e664
commit fb06b563a4
3 changed files with 6 additions and 2 deletions

View File

@ -395,7 +395,7 @@ private:
}
func.code = make_sp<CodeObject>(parser->src, func.name.str());
this->codes.push(func.code);
co()->_rvalue += 1; EXPR_TUPLE(); co()->_rvalue -= 1;
co()->_rvalue += 1; EXPR(); co()->_rvalue -= 1;
emit(OP_RETURN_VALUE);
func.code->optimize(vm);
this->codes.pop();

View File

@ -450,7 +450,7 @@ template<> bool _py_cast<bool>(VM* vm, const PyVar& obj){
return obj == vm->True;
}
PyVar py_var(VM* vm, const char* val){
PyVar py_var(VM* vm, const char val[]){
return VAR(Str(val));
}

4
tests/_bugs.py Normal file
View File

@ -0,0 +1,4 @@
# https://github.com/blueloveTH/pocketpy/issues/37
mp = map(lambda x: x**2, [1, 2, 3, 4, 5] )
assert list(mp) == [1, 4, 9, 16, 25]