This commit is contained in:
blueloveTH 2024-05-24 23:18:36 +08:00
parent 6099e62314
commit 1b2fae94eb
3 changed files with 6 additions and 4 deletions

View File

@ -287,14 +287,16 @@ public:
template<typename... Args>
PyVar call(PyVar callable, Args&&... args){
PUSH(callable); PUSH(PY_NULL);
s_data.push(callable);
s_data.emplace(PY_NULL);
__push_varargs(args...);
return vectorcall(sizeof...(args));
}
template<typename... Args>
PyVar call_method(PyVar self, PyVar callable, Args&&... args){
PUSH(callable); PUSH(self);
s_data.push(callable);
s_data.push(self);
__push_varargs(args...);
return vectorcall(sizeof...(args));
}

View File

@ -173,7 +173,7 @@ __NEXT_STEP:
}
PUSH(obj);
} DISPATCH()
case OP_LOAD_NULL: PUSH(PY_NULL); DISPATCH()
case OP_LOAD_NULL: s_data.emplace(PY_NULL); DISPATCH()
/*****************************************/
case OP_LOAD_FAST: {
PyVar _0 = frame->_locals[byte.arg];

View File

@ -1107,7 +1107,7 @@ PyVar VM::vectorcall(int ARGC, int KWARGC, bool op_call){
obj = vm->new_object<DummyInstance>(PK_OBJ_GET(Type, callable));
}else{
PUSH(new_f);
PUSH(PY_NULL);
s_data.emplace(PY_NULL);
PUSH(callable); // cls
for(PyVar o: args) PUSH(o);
for(PyVar o: kwargs) PUSH(o);