mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 12:00:18 +00:00
some fix
This commit is contained in:
parent
e88744eadc
commit
3edbe7cdf5
@ -48,6 +48,8 @@ struct PyTypeInfo{
|
|||||||
|
|
||||||
Vt(): _dtor(nullptr), _gc_mark(nullptr) {}
|
Vt(): _dtor(nullptr), _gc_mark(nullptr) {}
|
||||||
|
|
||||||
|
operator bool() const { return _dtor || _gc_mark; }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline static Vt get(){
|
inline static Vt get(){
|
||||||
static_assert(std::is_same_v<T, std::decay_t<T>>);
|
static_assert(std::is_same_v<T, std::decay_t<T>>);
|
||||||
|
@ -212,6 +212,15 @@ namespace pkpy{
|
|||||||
Str error = _S("type ", base_info.name.escape(), " is not `subclass_enabled`");
|
Str error = _S("type ", base_info.name.escape(), " is not `subclass_enabled`");
|
||||||
throw std::runtime_error(error.c_str());
|
throw std::runtime_error(error.c_str());
|
||||||
}
|
}
|
||||||
|
if(base_info.vt){
|
||||||
|
if(vt){
|
||||||
|
Str error = _S("type ", base_info.name.escape(), " has a custom vtable, cannot override");
|
||||||
|
throw std::runtime_error(error.c_str());
|
||||||
|
}else{
|
||||||
|
// promote base vt to its subclass
|
||||||
|
vt = base_info.vt;
|
||||||
|
}
|
||||||
|
}
|
||||||
_all_types.emplace_back(obj, base, mod, name, subclass_enabled, vt);
|
_all_types.emplace_back(obj, base, mod, name, subclass_enabled, vt);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user