This commit is contained in:
blueloveTH 2025-03-12 19:00:13 +08:00
parent 4ca291b179
commit a4f186057d
2 changed files with 1 additions and 3 deletions

View File

@ -594,7 +594,7 @@ PK_API bool py_isidentical(py_Ref, py_Ref);
/// Call a function.
/// It prepares the stack and then performs a `vectorcall(argc, 0, false)`.
/// The result will be set to `py_retval()`.
/// The stack remains unchanged after the operation.
/// The stack remains unchanged if successful.
PK_API bool py_call(py_Ref f, int argc, py_Ref argv) PY_RAISE PY_RETURN;
#ifndef NDEBUG

View File

@ -114,13 +114,11 @@ bool py_call(py_Ref f, int argc, py_Ref argv) {
if(f->type == tp_nativefunc) {
return py_callcfunc(f->_cfunc, argc, argv);
} else {
py_StackRef p0 = py_peek(0);
py_push(f);
py_pushnil();
for(int i = 0; i < argc; i++)
py_push(py_offset(argv, i));
bool ok = py_vectorcall(argc, 0);
pk_current_vm->stack.sp = p0;
return ok;
}
}