fix a bug

This commit is contained in:
blueloveTH 2024-09-02 23:11:06 +08:00
parent 86b4fc623c
commit 8277895502
2 changed files with 14 additions and 2 deletions

View File

@ -603,8 +603,19 @@ static void mark_object(PyObject* obj) {
} }
void CodeObject__gc_mark(const CodeObject* self) { void CodeObject__gc_mark(const CodeObject* self) {
c11__foreach(py_TValue, &self->consts, i) { pk__mark_value(i); } for(int i = 0; i < self->consts.length; i++) {
c11__foreach(FuncDecl_, &self->func_decls, i) { CodeObject__gc_mark(&(*i)->code); } py_TValue* p = c11__at(py_TValue, &self->consts, i);
pk__mark_value(p);
}
for(int i = 0; i < self->func_decls.length; i++) {
FuncDecl_ decl = c11__getitem(FuncDecl_, &self->func_decls, i);
CodeObject__gc_mark(&decl->code);
for(int j = 0; j < decl->kwargs.length; j++) {
FuncDeclKwArg* kw = c11__at(FuncDeclKwArg, &decl->kwargs, j);
pk__mark_value(&kw->value);
}
}
} }
void ManagedHeap__mark(ManagedHeap* self) { void ManagedHeap__mark(ManagedHeap* self) {

View File

@ -278,6 +278,7 @@ static bool builtins_round(int argc, py_Ref argv) {
} }
static bool builtins_print(int argc, py_Ref argv) { static bool builtins_print(int argc, py_Ref argv) {
// print(*args, sep=' ', end='\n')
py_TValue* args; py_TValue* args;
int length = pk_arrayview(argv, &args); int length = pk_arrayview(argv, &args);
assert(length != -1); assert(length != -1);