From 0c9e49a30d7e58ebdbac240af97bc407dac3ea6a Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 18 May 2024 17:51:09 +0800 Subject: [PATCH] some fix --- include/pocketpy/obj.h | 1 + src/vm.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/pocketpy/obj.h b/include/pocketpy/obj.h index 15621e71..6b4765ea 100644 --- a/include/pocketpy/obj.h +++ b/include/pocketpy/obj.h @@ -172,6 +172,7 @@ obj_get_t PyVar::obj_get(){ if constexpr(is_sso_v){ return as(); }else{ + PK_DEBUG_ASSERT(!is_sso) return ((Py_*)(_1))->_value; } } diff --git a/src/vm.cpp b/src/vm.cpp index bb604be9..36556ff8 100644 --- a/src/vm.cpp +++ b/src/vm.cpp @@ -999,14 +999,14 @@ PyVar VM::vectorcall(int ARGC, int KWARGC, bool op_call){ PyVar* p0 = p1 - ARGC - 2; // [callable, , args..., kwargs...] // ^p0 ^p1 ^_sp - PyVar callable = p1[-(ARGC + 2)]; + PyVar callable = p1[-ARGC-2]; Type callable_t = _tp(callable); int method_call = p0[1] != PY_NULL; // handle boundmethod, do a patch if(callable_t == tp_bound_method){ - if(method_call) PK_FATAL_ERROR(); + PK_DEBUG_ASSERT(!method_call) BoundMethod& bm = PK_OBJ_GET(BoundMethod, callable); callable = bm.func; // get unbound method callable_t = _tp(callable);