From 9c173fdada03a8d40db993f35722cb6d9f567352 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sun, 4 Aug 2024 20:38:49 +0800 Subject: [PATCH] ... --- src/interpreter/vm.c | 2 +- tests/41_class_ex.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/interpreter/vm.c b/src/interpreter/vm.c index 73f8a45f..3aadb91d 100644 --- a/src/interpreter/vm.c +++ b/src/interpreter/vm.c @@ -202,7 +202,7 @@ void VM__dtor(VM* self) { // destroy all objects ManagedHeap__dtor(&self->heap); // clear frames - // ... + while(self->top_frame) VM__pop_frame(self); NameDict__dtor(&self->modules); c11__foreach(py_TypeInfo, &self->types, ti) py_TypeInfo__dtor(ti); c11_vector__dtor(&self->types); diff --git a/tests/41_class_ex.py b/tests/41_class_ex.py index 9a3b6304..2a234c2a 100644 --- a/tests/41_class_ex.py +++ b/tests/41_class_ex.py @@ -1,7 +1,11 @@ class A: - def __init__(self, a, b): + def __init__(self, a, __b): self.a = a - self.b = b + self.__b = __b + + @property + def b(self): + return self.__b def add(self): return self.a + self.b