mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 12:00:18 +00:00
some fix
This commit is contained in:
parent
cef275f900
commit
47463290a6
@ -178,11 +178,7 @@ struct PyVar final{
|
|||||||
char _bytes[12];
|
char _bytes[12];
|
||||||
|
|
||||||
// uninitialized
|
// uninitialized
|
||||||
#if PK_DEBUG_EXTRA_CHECK
|
|
||||||
PyVar(): type() { }
|
|
||||||
#else
|
|
||||||
PyVar() = default;
|
PyVar() = default;
|
||||||
#endif
|
|
||||||
// zero initialized
|
// zero initialized
|
||||||
PyVar(std::nullptr_t): type(), is_sso(false), flags(0), _bytes{0} { }
|
PyVar(std::nullptr_t): type(), is_sso(false), flags(0), _bytes{0} { }
|
||||||
// PyObject* initialized (is_sso = false)
|
// PyObject* initialized (is_sso = false)
|
||||||
|
@ -206,7 +206,7 @@ namespace pkpy{
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyVar VM::new_type_object(PyVar mod, StrName name, Type base, bool subclass_enabled){
|
PyVar VM::new_type_object(PyVar mod, StrName name, Type base, bool subclass_enabled){
|
||||||
PyVar obj = heap._new<Type>(tp_type, Type(_all_types.size()+1));
|
PyVar obj = heap._new<Type>(tp_type, Type(_all_types.size()));
|
||||||
const PyTypeInfo& base_info = _all_types[base];
|
const PyTypeInfo& base_info = _all_types[base];
|
||||||
if(!base_info.subclass_enabled){
|
if(!base_info.subclass_enabled){
|
||||||
Str error = _S("type ", base_info.name.escape(), " is not `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
|
#endif
|
||||||
|
|
||||||
void VM::__init_builtin_types(){
|
void VM::__init_builtin_types(){
|
||||||
|
_all_types.push_back({nullptr, Type(), nullptr, "", false}); // 0 is not used
|
||||||
_all_types.push_back({heap._new<Type>(tp_type, tp_object), Type(), nullptr, "object", true});
|
_all_types.push_back({heap._new<Type>(tp_type, tp_object), Type(), nullptr, "object", true});
|
||||||
_all_types.push_back({heap._new<Type>(tp_type, tp_type), tp_object, nullptr, "type", false});
|
_all_types.push_back({heap._new<Type>(tp_type, tp_type), tp_object, nullptr, "type", false});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user