mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
...
This commit is contained in:
parent
4ca291b179
commit
a4f186057d
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user