From 47463290a651e4f5040baf728930a947f3207de5 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Mon, 13 May 2024 02:04:19 +0800 Subject: [PATCH] some fix --- include/pocketpy/common.h | 4 ---- src/vm.cpp | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/pocketpy/common.h b/include/pocketpy/common.h index e63eeda0..339884e0 100644 --- a/include/pocketpy/common.h +++ b/include/pocketpy/common.h @@ -178,11 +178,7 @@ struct PyVar final{ char _bytes[12]; // uninitialized -#if PK_DEBUG_EXTRA_CHECK - PyVar(): type() { } -#else PyVar() = default; -#endif // zero initialized PyVar(std::nullptr_t): type(), is_sso(false), flags(0), _bytes{0} { } // PyObject* initialized (is_sso = false) diff --git a/src/vm.cpp b/src/vm.cpp index fcb47bd6..374270ff 100644 --- a/src/vm.cpp +++ b/src/vm.cpp @@ -206,7 +206,7 @@ namespace pkpy{ } PyVar VM::new_type_object(PyVar mod, StrName name, Type base, bool subclass_enabled){ - PyVar obj = heap._new(tp_type, Type(_all_types.size()+1)); + PyVar obj = heap._new(tp_type, Type(_all_types.size())); const PyTypeInfo& base_info = _all_types[base]; if(!base_info.subclass_enabled){ Str error = _S("type ", base_info.name.escape(), " is not `subclass_enabled`"); @@ -825,6 +825,7 @@ void VM::__log_s_data(const char* title) { #endif void VM::__init_builtin_types(){ + _all_types.push_back({nullptr, Type(), nullptr, "", false}); // 0 is not used _all_types.push_back({heap._new(tp_type, tp_object), Type(), nullptr, "object", true}); _all_types.push_back({heap._new(tp_type, tp_type), tp_object, nullptr, "type", false});