mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
fix py_bind
This commit is contained in:
parent
9564013c1d
commit
fb3c9a0399
@ -472,8 +472,18 @@ FrameResult VM__vectorcall(VM* self, uint16_t argc, uint16_t kwargc, bool opcall
|
|||||||
// initialize local variables to py_NIL
|
// initialize local variables to py_NIL
|
||||||
memset(p1, 0, (char*)self->stack.sp - (char*)p1);
|
memset(p1, 0, (char*)self->stack.sp - (char*)p1);
|
||||||
// submit the call
|
// submit the call
|
||||||
|
if(!fn->cfunc) {
|
||||||
|
// python function
|
||||||
VM__push_frame(self, Frame__new(co, &fn->module, p0, argv, true));
|
VM__push_frame(self, Frame__new(co, &fn->module, p0, argv, true));
|
||||||
return opcall ? RES_CALL : VM__run_top_frame(self);
|
return opcall ? RES_CALL : VM__run_top_frame(self);
|
||||||
|
} else {
|
||||||
|
// decl-based binding
|
||||||
|
self->__curr_function = p0;
|
||||||
|
bool ok = py_callcfunc(fn->cfunc, co->nlocals, argv);
|
||||||
|
self->stack.sp = p0;
|
||||||
|
self->__curr_function = NULL;
|
||||||
|
return ok ? RES_RETURN : RES_ERROR;
|
||||||
|
}
|
||||||
case FuncType_GENERATOR: {
|
case FuncType_GENERATOR: {
|
||||||
bool ok = prepare_py_call(self->__vectorcall_buffer, argv, p1, kwargc, fn->decl);
|
bool ok = prepare_py_call(self->__vectorcall_buffer, argv, p1, kwargc, fn->decl);
|
||||||
if(!ok) return RES_ERROR;
|
if(!ok) return RES_ERROR;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user