From 69f820acc62cf0d784d75e09e84cfca883985906 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sun, 20 Nov 2022 23:03:40 +0800 Subject: [PATCH] Update vm.h --- src/vm.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/vm.h b/src/vm.h index ad77086d..5e5cd425 100644 --- a/src/vm.h +++ b/src/vm.h @@ -374,8 +374,8 @@ public: } bool __isFrameValid(Frame* frame){ - for(const auto& f : callstack){ - if(f.get() == frame) return true; + for(auto it=callstack.crbegin(); it!=callstack.crend(); ++it){ + if(it->get() == frame) return true; } return false; } @@ -687,7 +687,12 @@ public: __DEF_PY_POOL(Float, _Float, _tp_float, 256); __DEF_PY_AS_C(Float, _Float, _tp_float) __DEF_PY_POOL(Pointer, _Pointer, _tp_pointer, 256) - __DEF_PY_AS_C(Pointer, _Pointer, _tp_pointer) + + inline _Pointer& PyPointer_AS_C(const PyVar& obj) + { + if(!obj->isType(_tp_pointer)) typeError("expected an l-value"); + return std::get<_Pointer>(obj->_native); + } DEF_NATIVE(Str, _Str, _tp_str) DEF_NATIVE(List, PyVarList, _tp_list)