This commit is contained in:
blueloveTH 2024-07-14 23:47:19 +08:00
parent 51e2433404
commit 31d095e3cc
2 changed files with 6 additions and 9 deletions

View File

@ -231,7 +231,9 @@ pk_FrameResult pk_VM__run_top_frame(pk_VM* self) {
goto __ERROR;
}
case OP_LOAD_ATTR: {
if(!py_getattr(TOP(), byte.arg, TOP())) {
int res = py_getattr(TOP(), byte.arg, TOP());
if(res == -1) goto __ERROR;
if(!res) {
AttributeError(TOP(), byte.arg);
goto __ERROR;
}
@ -320,8 +322,7 @@ pk_FrameResult pk_VM__run_top_frame(pk_VM* self) {
DISPATCH();
}
case OP_STORE_ATTR: {
int err = py_setattr(TOP(), byte.arg, SECOND());
if(err) goto __ERROR;
if(!py_setattr(TOP(), byte.arg, SECOND())) goto __ERROR;
STACK_SHRINK(2);
DISPATCH();
}

View File

@ -517,12 +517,8 @@ static void mark_object(PyObject* obj) {
if(obj->type == tp_list) {
pk_list__mark(PyObject__userdata(obj), mark_value);
return;
}
if(obj->type == tp_dict) {
} else if(obj->type == tp_dict) {
pk_dict__mark(PyObject__userdata(obj), mark_value);
return;
}
}
@ -551,7 +547,7 @@ void pk_ManagedHeap__mark(pk_ManagedHeap* self) {
}
void pk_print_stack(pk_VM* self, Frame* frame, Bytecode byte) {
return;
// return;
py_TValue* sp = self->stack.sp;
c11_sbuf buf;